Skip to content

Posts from Current questions and answers regarding the map editor. Auto-translated

5.0 (12 ratings)
User Avatar
#5232
Auto-translated
Make the task a secondary one in the Map Properties Tree and activate (and execute) it with a script. And you can nicely format the conversation with the hermit using TalkBox.
С уважением, }{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
#5233
Auto-translated
Another question arose. What's wrong with this script?

Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'Alteris-ruini', 'RegionEnter');
function RegionEnter(Itil)
MessageBox(path.."Alteris.txt");
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'Alteris-ruini', nil);
end;

The idea is this: when Ilfina enters the region Alteris-ruini, a text message should appear, and then the script should stop.
And another question: is it possible to ensure that if there is an error with one of the scripts, the others will still execute correctly? Because after adding this script, the script with messages for each day of the game stopped working.
User Avatar
#5234
Auto-translated
I see an unnecessary `end`.

It's possible. Using a `try except` construct.
More precisely... Maybe I'm wrong. I googled it and couldn't find how it's done in Lua; perhaps it's done differently.
Error handling is definitely implemented by Durman in the NHF mod scripts. Try downloading it and take a look at how it's done. But `try` is likely used.
 

К А
Стикеры GBF в Telegram
In reply to Ment
User Avatar
#5235
Auto-translated
Ment
I see an extra end..
Thank you very much, the script works!
In reply to Navkratis
User Avatar
#5236
Auto-translated
Navkratis
And another question: is it possible to make it so that if there is an error with one of the scripts, the rest will still be executed correctly? Because after adding this script, the script with messages for each day of the game stopped working.

Please, refer to code snippets as blocks, functions, or sections of the script, but not as scripts.

Firstly, there is a function called errorHook(sFunc). You insert it inside the function you are testing, and if there is an error inside it, the sFunc function will be executed first. But this will only help with debugging. Secondly, if an error occurs inside a function, only the subsequent lines of that function will not be executed. However: if an error occurs outside of a function and before a trigger, the trigger will not load, and the function will not be executed. Therefore, the best approach is to insert errorHook at the beginning of the script and write copies of all triggers into the sFunc function:
function Error()
Trigger(...)
Trigger(...)
...
Trigger(...)
end;
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to Navkratis
User Avatar
#5238
Auto-translated
Another issue has emerged, which seems incredibly simple, but it still caused me some trouble. In the attached screenshot, the ShowCompleted value is currently set to true, and therefore the quest is initially marked as completed. However, when I change this value to false (without touching anything else), the quest mysteriously disappears from the list. P.S. And another problem – what's wrong with this script? Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'enti', 'RegionEnter'); function RegionEnter(Itil) MessageBox(path.."ent.txt"); AddHeroCreatures(Itil, CREATURE ANCIENT TREANTS, 1); Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'enti', nil); end; end;
Attachments 1
1 file attached • Total size: 37.9 KB
User Avatar
#5239
Auto-translated
Is it possible to control the amount of experience awarded in chests? For example, could a specific chest always contain exactly 500 experience points and 1000 gold?
In reply to Miss Stark
User Avatar
#5240
Auto-translated
Miss Stark
Is it possible to control the amount of experience given in chests? For example, so that a specific chest contains exactly 500 experience points and 1000 gold?
Yes, it is. In the map editor, select the chest, press the spacebar, select the "fixed" option, and enter
1
For example: if you enter "1", the chest will contain 1000 gold / 500 experience points.
2 - 1500/1000
3 - 2000/1500
and so on.

Added 14 minutes later
Navkratis


P.S. And one more problem - what's wrong with this script?

Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'enti', 'RegionEnter');
function RegionEnter(Itil)
MessageBox(path.."ent.txt");
AddHeroCreatures(Itil, CREATURE ANCIENT TREANTS, 1);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'enti', nil);
end;
end;
The first thing that catches the eye is CREATURE ANCIENT TREANTS and the missing quotes.
You need to specify the ID (number) of the monster from the game's documentation PDF file.
I understand that you need Ancient Ents. Then you need to write the following:
AddHeroCreatures("Itil", 54, 1);
and there might be one extra "end".
In reply to Fallenru
User Avatar
#5241
Auto-translated
Thank you very much, everything worked out :) Before this, I tried to create a script based on the example from HOMM5_Editor_Practical_Guide_rus, but it seems that the information there is not accurate.

Added 3 hours 55 minutes ago
And if possible, I'll ask one last question, again, about "what's wrong here?":

Trigger(OBJECT_TOUCH_TRIGGER, 'providez', 'providezF');
SetObjectEnabled('providez', false)
function providezF(Itil)
MessageBox(path.."xizina.txt");
AddHeroSpells("Itil", 40);
Trigger(OBJECT_TOUCH_TRIGGER, 'providez', nil);
end;

The idea is that when a hero approaches the seer's hut, a certain message appears, and he receives the "Phantom Power" spell. The message appears, but the spell does not.
User Avatar
#5242
Auto-translated
Check the console more often to identify such errors. It would display "Value was nil when getting global with name 'AddHeroSpells'!", which means the variable AddHeroSpells was not defined. All script functions are variables containing functions that are defined from the Lua scripts that run with the game. If the variable is not defined, then that function does not exist. Then, refer to the manual (or in the script editor, click Ctrl+Space) and find out that there is only the function TeachHeroSpell. Use that instead.

If you follow this principle of error analysis, you won't need help. You can also use the debugging method by Jack_of_Shadows.
С уважением, }{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
#5243
Auto-translated
Thank you, that helped. Now I just need to do a test playthrough of the scenario, and then I can finally take a break from all these evil scripts :rolleyes:

Added 3 hours 12 minutes ago
During testing, I discovered that the script sections mentioned above (with the region entry) are somehow activated even when enemy heroes enter those regions, although the intention was that they would only be executed when Ilfina is inside them. So now there are two options: either abandon the map, which probably won't interest anyone anyway :rolleyes:, or ask the forum for help to figure out what went wrong:o
User Avatar
#5244
Auto-translated
Well, obviously, regions work for any hero. Inside the parentheses after each function triggered by entering a region, insert a variable, for example, heroname. Next: ``` function example(heroname) if heroname=="Itil" then Desired code end; end;
С уважением, }{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
#5245
Auto-translated
Thank you very much, everything seems to be working so far, now we just need to survive until the end of the test run :D
User Avatar
#5246
Auto-translated
Could you please tell me how to configure a map so that the difficulty level doesn't affect the starting amount of gold and resources for a specific player? For example, how can I ensure that a specific player always starts with the resources equivalent to the "Hero" difficulty, regardless of the chosen difficulty level?