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.
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--