Skip to content
#221
Auto-translated
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--

Statistics

Welcome our newest member: Emil