Connection ErrorBad RequestThis page went staleSession ExpiredSign in requiredForbiddenNot FoundToo Many RequestsServer ErrorBad GatewayService UnavailableGateway TimeoutHTTP Version Not Supported
Session Expired
Your session has expired. Please log in to continue.
Sign in required
You need an account to do that. Sign in or create one — it only takes a minute.
This page went stale
Your security token was rejected, usually because the page sat open too long or you signed in elsewhere. Nothing was saved. Reload the page and try again.
Request Failed
We encountered an issue while processing your request.
Please check your internet connection and try again.
A. Well, it seems that point number 3 did have an effect. I'm afraid I'll have to make the script more complex – the gaz task should be placed in the objectives tab, as a general task, but initially invisible. It should be triggered by OBJECT_TOUCH_TRIGGER with a house, and the house should have its standard functions disabled (first, display a message, then – the task). But first, I need to check – if I set gaz as a general and accessible task from the very beginning, will it work?
Somewhere in the archive with the map. The path to the text file in the map archive is the same path you write in the scripts.
Usually, it is placed where map.xdb, terrain.bin, and other files related to that specific map are located.
That's exactly what it is. When the map editor starts, this archive (which is actually a zip file, even if it's labeled differently) is unpacked. After closing the editor, all changes are packed back into it.
No, there's some other directory... I don't remember exactly, something like Editor -> H5mMods -> the folder with the map's name.
But to avoid messing things up, it's better to close the editor and open the map archive using WinRAR. And put it there.
Hello, I'm back to working on the game. I still haven't figured out how MessageBox works. Also, it won't open the zip file. Could you provide a couple of screenshots or explain everything step by step again?
Hello, could you please give me some advice? I have a building on the map where I want to recruit troops using script functions. How can I make these functions execute sequentially, without interrupting each other? According to the Manuals, there should be an if condition in the second function, but what should it be?
Here are the functions:
--Start--
--Naim1--
function Naim1(hero)
Naim1_hero = hero
MessageBox("/Maps/SingleMissions/Time of Troubles1/Naim1MB.txt")
QuestionBox("/Maps/SingleMissions/Time of Troubles1/Naim1QB.txt", "Naim1_ok");
end
function Naim1_ok()
local gold = GetPlayerResource(PLAYER_1, GOLD)
if gold >= 3000 then
Trigger(OBJECT_TOUCH_TRIGGER, "Tavern", nil)
SetPlayerResource(PLAYER_1, GOLD, gold - 3000)
AddHeroCreatures(Naim1_hero, 4, 30)
else
MessageBox("/Maps/SingleMissions/Time of Troubles1/Naim2MB.txt")
end
end
Trigger(OBJECT_TOUCH_TRIGGER, "Tavern", "Naim1")
--Naim2--
function Naim2(hero)
Naim2_hero = hero
MessageBox("/Maps/SingleMissions/Time of Troubles1/Naim3MB.txt")
QuestionBox("/Maps/SingleMissions/Time of Troubles1/Naim2QB.txt", "Naim2_ok");
end
function Naim2_ok()
local gold = GetPlayerResource(PLAYER_1, GOLD)
if gold >= 7000 then
Trigger(OBJECT_TOUCH_TRIGGER, "Tavern", nil)
SetPlayerResource(PLAYER_1, GOLD, gold - 7000)
AddHeroCreatures(Naim1_hero, 11, 3)
else
MessageBox("/Maps/SingleMissions/Time of Troubles1/Naim4MB.txt")
end
end
Trigger(OBJECT_TOUCH_TRIGGER, "Tavern", "Naim2")
--End--
If you need the second function to execute only after the first creatures have been hired, you can replace "nil" with "Naim2" in the trigger under the condition "if gold >= 3000 then". This is how it would look:
... if gold >= 3000 then Trigger(OBJECT_TOUCH_TRIGGER, "Tavern", "Naim2") SetPlayerResource(PLAYER_1, GOLD, gold - 3000) AddHeroCreatures(Naim1_hero, 4, 30) else ...
And remove Trigger(OBJECT_TOUCH_TRIGGER, "Tavern", "Naim2") at the very end. In this case, the trigger for "Naim1" will be activated at the beginning, and after hiring, it will be replaced with "Naim2", and after hiring the second set of creatures, it will be reset.
Thank you very much, it helped. Could you please give me another piece of advice? How can I implement the following idea: initially, a certain building cannot be constructed in a town, but it can be unlocked and upgraded by completing a side quest. I have already created the initial dialogue window with the NPC and configured the quest (destroying a group of neutral creatures). However, I have some questions: how can I, upon completing the quest and returning to the NPC, disable the initial function with dialogue #1 and activate the function with dialogue #2 in the same region, and unlock the building as a reward?
----
Function for the introduction, with dialogue #1
----
function Barracks_build(hero)
Barracks_hero = hero
MessageBox("/Maps/SingleMissions/Time of Troubles1/Barracks_building.txt",nil)
QuestionBox("/Maps/SingleMissions/Time of Troubles1/Barracks_buildingQB.txt", "Barracks_build_ok",nil);
end
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "QuestSword", "Barracks_build",nil)
----
Function for agreement, with dialogue #2
----
function Barracks_build_ok()
MessageBox("/Maps/SingleMissions/Time of Troubles1/Barracks_building1.txt");
SetObjectiveState("zadanie1", OBJECTIVE_ACTIVE,1);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "QuestSword", "Barracks_build",nil)
end
----
As an alternative, you can write the following in the Barracks_build_ok function:
```
function Barracks_build_ok()
MessageBox("/Maps/SingleMissions/Time of Troubles1/Barracks_building1.txt");
SetObjectiveState("zadanie1", OBJECTIVE_ACTIVE,1);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "QuestSword", nil)
startThread( _Barracks_build_mob_monitor);
end
```
And here is the _Barracks_build_mob_monitor function itself:
```
function _Barracks_build_mob_monitor ()
while 1 do
sleep(2);
if not Exists("Neutral") then
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "QuestSword", "Barracks_build_2");
break
end;
end;
end;
```
It checks in a separate thread whether the 'Neutral' unit exists (Exists("Neutral")). If it is defeated at some point, the trigger for the region changes to "Barracks_build_2" - a function with dialogue #2.
The completion of the quest depends on its type (kind). If it is OBJECTIVE_KIND_MANUAL, it can be completed with the following line:
```
SetObjectiveState('zadanie1', OBJECTIVE_COMPLETED);
```
Place it under the condition if not Exists("Neutral") then, before the trigger.
If it is not OBJECTIVE_KIND_MANUAL, but is set to destroy a unit, it should complete automatically.
I haven't encountered any issues with unlocking buildings, but SetTownBuildingLimitLevel will likely help in this case.
Thank you very much, the main condition works perfectly. Now I need to find a script that unlocks buildings. I encountered something similar in the second mission for the Necromancer in the ToE campaign, something related to vampires.