Trigger
Trigger – set on/off the handler functions that work with events in the world
Syntax
Trigger(triggerType, ..., functionName);
Description
If the functionName parameter is not equal to nil, the function sets the handler function with
that name for the specified in-game event. Otherwise the function removes the handler from this
event. For each event, there can be only one handler function set. Setting another function onto
the event which is already handled will remove the first handler.
triggerType – in-game event type; can take on one of the following values:
NEW_DAY_TRIGGER – new day begins
WAR_FOG_ENTER_TRIGGER – the hero enters the fog of war (the behavior of the fog of war is
controlled by the SetWarfogBehaviour function)
PLAYER_ADD_HERO_TRIGGER – the player has a new hero
PLAYER_REMOVE_HERO_TRIGGER – the player has lost a hero
OBJECTIVE_STATE_CHANGE_TRIGGER – the objective’s status has been changed
OBJECT_CAPTURE_TRIGGER – the object has been captured
OBJECT_TOUCH_TRIGGER – the interactive object has been interacted with
TOWN_HERO_DEPLOY_TRIGGER – the hero leaves the town
REGION_ENTER_AND_STOP_TRIGGER – the hero enters the region (and must stay within it)
REGION_ENTER_WITHOUT_STOP_TRIGGER – the hero enters the region (and does not have to stay
within it)
HERO_LEVELUP_TRIGGER – the hero gains a level