Tested with Ironfist version 1.2.1+ (version of December 15, 2016).
*
Currently, there is no way to execute instructions after an event is completed, it's always before.
*
"WaitEndOfEvent" waits for the end of an event to continue the instructions.
It can be used with callbacks that can trigger events.
Currently:
- OnLocationVisit
- OnHeroMove
- OnUnitRecruit
Examples of use:
function OnLocationVisit(type, x, y)
if x == 6 and y == 3 and type == LOCATION_RUINS then
MessageBox("Text displayed before visiting the Ruins.");
MessageBox("Text still displayed before visiting the Ruins.");
end
end;
When the hero moves on the active square of the Ruins, this happens:
The message box "Text displayed before visiting the Ruins." is displayed first.
Then, the message box "Text still displayed before visiting the Ruins." is displayed.
Then, the standard box of the location "Ruins - You've found some Medusas living in the ruins. They are willing to join your army for a price. Do you want to recruit Medusa? [YES] [NO]" is displayed.
And then, the recruit box for the Medusas is displayed.
function OnLocationVisit(type, x, y)
if x == 6 and y == 3 and type == LOCATION_RUINS then
MessageBox("Text displayed before visiting the Ruins.");
WaitEndOfEvent();
MessageBox("Text displayed after visiting the Ruins.");
end
end;
With "WaitEndOfEvent", when the hero moves on the active square of the Ruins, this happens:
The message box "Text displayed before visiting the Ruins." is displayed first.
Then, the standard box of the location "Ruins - You've found some Medusas living in the ruins. They are willing to join your army for a price. Do you want to recruit Medusa? [YES] [NO]" is displayed.
Then, the recruit box for the Medusas is displayed.
After the recruit box for the Medusas is closed, the message "Text displayed after visiting the Ruins." is displayed.
*
function OnHeroMove(x, y)
if x == 10 and y == 9 then
MessageBox("Text displayed before visiting the Ore Mine.");
WaitEndOfEvent();
MessageBox("Text displayed after visiting the Ore Mine.");
end
end;
With "WaitEndOfEvent", when the hero moves on the active square of the Ore Mine, this happens:
The message box "Text displayed before visiting the Ore Mine." is displayed first.
Then, the standard box of the location "Ore Mine - You gain control of an ore mine. It will provide you with two units of ore per day. [OKAY]" is displayed.
Then, the message box "Text displayed after visiting the Ore Mine." is displayed.
*
function OnUnitRecruit(creatureid)
if creatureid == CREATURE_RANGER then
MessageBox("The Rangers were eagerly awaiting you.");
WaitEndOfEvent();
MessageBox("The Rangers wish you a glorious victory!!!");
end
end;
With "WaitEndOfEvent", when the user recruit Rangers, the message "The Rangers were eagerly awaiting you." is displayed.
Then, the recruit box for the Rangers is opened.
After the recruit box for the Rangers is closed, the message "The Rangers wish you a glorious victory!!!" is displayed.
***** Updated on March 12, 2017 *****
Also with:
- OnBattleStart
Example of use:
function OnBattleStart()
if GetHeroName(BattleGetHero(1)) == "Ector" then
MessageBox("The battle begins... Good luck Ector!!!");
WaitEndOfEvent();
MessageBox("Text displayed after the end of the combat.");
end
end;
With "WaitEndOfEvent", when the battle starts, this happens:
The message box "The battle begins... Good luck Ector!!!" is displayed first.
Then, the combat takes place.
And after the last message box of the end of the combat is closed, the message "Text displayed after the end of the combat." is displayed.
***** Updated on March 17, 2017 *****
Also with:
- OnTownOpen
"WaitEndOfEvent" waits for the end of the "animation" of the exit of the town after the player has clicked the "EXIT" button and is back on the view of the map.
- OnBattleMeleeAttack
"WaitEndOfEvent" waits for the end of the "animation" of the melee attack.