Skip to content

Posts from When I click Edit Script, the program closes.

No ratings yet — be the first to rate!
User Avatar
Auto-translated
I open the editor, click on "Edit Script," and the program closes. Even when I open another program for scripts, I can't find "lua" or "lau" – I don't remember how it's spelled.
User Avatar
Auto-translated
The best advice for anyone facing a similar problem is to forget about the Edit Script button altogether. Never even try to use it if you need to edit scripts. Creating a file for scripts is possible, but editing them using that button is not! So, what should you do? Here's how I work: Find the map files (they might be in a hidden folder). There, you'll find the MapScript.lua file (the extension might not be displayed if you haven't enabled the display of extensions in your system settings). Next, open the map in the map editor, and open (if you haven't already) the MapScript.lua file, and modify it as you like (within reasonable limits, of course). After you're finished adding/changing things, save the file, and simply restart the map, i.e., click "Open Map" and select the same map. It's best not to touch anything on the map itself during this process; otherwise, it might happen that the script will be saved along with the changes on the map, meaning all the edits in the file will be lost. However, I don't guarantee that this will definitely happen, so feel free to experiment
In reply to Азгалор
User Avatar
Auto-translated
I followed all your instructions, but unfortunately, I couldn't find the MapScript.lua file.
User Avatar
Auto-translated
Open the map, go to Map Properties Tree => MapScript => Click on the line => New => Enter a name, for example, MainScript => OK. Save and close the map. Then, download this pack -> https://yadi.sk/d/W6cz5UBu3SGAvb, open the practice folder => ... run the H5MapScriptsEditor program located there. File => Open => Go to the Maps folder and select the map. When the map opens, open (if it's not already open) Maps/SingleMissions/MapName in the file tree on the left. Click on any file displayed in this folder. Then, click File => New *.lua => Enter the name MainScript.lua and click OK.

Save and close the script editor. Open the map editor and your map again, go to Map Properties Tree => MapScript => Click on the line => 3 dots => In the properties window that appears, find the first property line on the top right and enter the path to the script file: /Maps/SingleMissions/MapName/MainScript.lua. If the line does not disappear after pressing Enter, then you have done everything correctly. Save, close the editor. Open the script editor, your map, double-click on the MainScript.lua file to open it, and then enter your script.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
Auto-translated
There's a much more convenient option.
This thing doesn't work for me either, and it crashes.

But if you close the editor, open the map with an archiver, and find Maps/Multiplayer_or_whatever/scripts. (in the editor, you need to have a map script created beforehand, an empty one works fine)
http://c2n.me/4d2H7mC, you'll get something like this.
Ideally, you open it in Sublime Text or Notepad++, and you also get syntax highlighting. And you don't need to download anything, except Notepad++, which is free and useful for many things besides Heroes. At least to open *.txt and *.xml files and have a normal view, instead of the eye-straining Windows Notepad, even if your text file has nothing to do with Heroes.

By the way, after editing the script and saving, the archiver will ask if you want to update the file in the archive (yes/no), so you can edit it on the fly. But with the map editor closed.
User Avatar
Auto-translated
vasik, how does a randomly generated map, created by the user, end up with the "scripts" folder containing a bunch of scripts, just like Frozensoull's maps?
vasik
Look in Maps/Multiplayer_or_whatever/scripts. (You need to create a map script in the editor beforehand, an empty one is fine)
http://c2n.me/4d2H7mC, something like this will appear.
Maps/Multiplayer or SingleMissions/MapName/, to be precise, you'll find something like that.
Attachments 1
1 file attached • Total size: 71.9 KB
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
Auto-translated
ah, yes
you can write in mapscript and everything will work.

I guess I provided a good example, because many people don't even follow tabulations/indentations (although there are some here too).
You still need to create an empty mapscript in the editor.
User Avatar
Auto-translated
By the way, the script editor is incredibly convenient and useful compared to Notepad++.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
Auto-translated
For Khotabych, should I simply write the path or use three dots?
User Avatar
Auto-translated
You can simply enter the path, or navigate through the following folders: FolderGames/Editor/H5Mods/MapName/Maps/SingleMissions/MapName/ and select the lua file.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
Auto-translated
And now, how do I test it? Do I enter the script and then go to the map?
User Avatar
Auto-translated
Check if everything is correct? Write `print("Hello world!")` in the Lua file of the script and launch the map in the game. Open the map in the game and look at the console. If you did everything correctly, a green line with "Hello world!" will appear in the console.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
Auto-translated
the editor and the game cannot be run simultaneously; it will launch them one after the other, switching between the editor and the game, just to change a small value in the script?

When editing text in a file, you also need to close the game, but at least you don't have to open the editor 100 times, right?
User Avatar
Auto-translated
For those who don't want to open and close the game every time to edit the script, I recommend checking out the FAQ by Jack_of_Shadows 🧐
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
Auto-translated
By the way, the script editor and the game can be launched simultaneously. I see you are confusing the Map Editor and the Script Editor, the link to which I attached earlier.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________

Statistics

Welcome our newest member: Emil