cdvader
Documentation on Triggers
I hope this helps anyone. Please note, that Warband triggers are in as well.
ti_simulate_battle
Deprecated, do not use. Use script_game_event_simulate_battle in module_scripts instead.
ti_on_party_encounter
Deprecated, do not use. Use script_game_event_simulate_battle in module_scripts instead.
Deprecated, do not use. Use script_game_event_simulate_battle in module_scripts instead.
ti_on_party_encounter
Deprecated, do not use. Use script_game_event_simulate_battle in module_scripts instead.
ti_before_mission_start
No trigger parameters.
This trigger will run on the loading of the scene.
ti_after_mission_start
No trigger parameters.
This trigger will run after the scene has loaded.
ti_tab_pressed
No trigger parameters.
This trigger will run if the Tab key is pressed.
ti_question_answered
Trigger Parameter 1 - Value. '0' if Yes and '1' if No.
This trigger will run if you call the (question_box, <string>) command and press one of the buttons the question box provides.
ti_inventory_key_pressed
No trigger parameters.
This trigger will run if the Inventory key is pressed.
Using the (set_trigger_result, 1) in this trigger will open the inventory.
ti_escape_pressed
No trigger parameters.
This trigger will run if the Escape key is pressed.
ti_battle_window_opened
No trigger parameters.
Need clarification on this one.
ti_on_agent_spawn
Trigger Parameter 1 - The agent which just spawned.
This trigger will run if an agent spawns.
ti_on_agent_killed_or_wounded
Trigger Parameter 1 - The victim agent (who just fell in battle - died/knocked unconscious).
Trigger Parameter 2 - The killer agent (who just killed the victim agent/knocked the victim agent unconscious).
Trigger Parameter 3 - Victim killed/wounded? - Stores the variable '1' if the victim agent is wounded, '0' if killed.
This trigger will run if an agent is either killed or wounded.
ti_on_agent_knocked_down
Trigger Parameter 1 - The victim agent (who was just knocked down).
Trigger Parameter 2 - The killer agent (who knocked the victim down).
This trigger will run if an agent is not killed and not wounded, but knocked down. For example, if you get hit by the enemy and he has a big maul and knocks you down, then this trigger will run.
ti_on_leave_area
No trigger parameters.
This trigger will run if the player exits a scene.
No trigger parameters.
This trigger will run on the loading of the scene.
ti_after_mission_start
No trigger parameters.
This trigger will run after the scene has loaded.
ti_tab_pressed
No trigger parameters.
This trigger will run if the Tab key is pressed.
ti_question_answered
Trigger Parameter 1 - Value. '0' if Yes and '1' if No.
This trigger will run if you call the (question_box, <string>) command and press one of the buttons the question box provides.
ti_inventory_key_pressed
No trigger parameters.
This trigger will run if the Inventory key is pressed.
Using the (set_trigger_result, 1) in this trigger will open the inventory.
ti_escape_pressed
No trigger parameters.
This trigger will run if the Escape key is pressed.
ti_battle_window_opened
No trigger parameters.
Need clarification on this one.
ti_on_agent_spawn
Trigger Parameter 1 - The agent which just spawned.
This trigger will run if an agent spawns.
ti_on_agent_killed_or_wounded
Trigger Parameter 1 - The victim agent (who just fell in battle - died/knocked unconscious).
Trigger Parameter 2 - The killer agent (who just killed the victim agent/knocked the victim agent unconscious).
Trigger Parameter 3 - Victim killed/wounded? - Stores the variable '1' if the victim agent is wounded, '0' if killed.
This trigger will run if an agent is either killed or wounded.
ti_on_agent_knocked_down
Trigger Parameter 1 - The victim agent (who was just knocked down).
Trigger Parameter 2 - The killer agent (who knocked the victim down).
This trigger will run if an agent is not killed and not wounded, but knocked down. For example, if you get hit by the enemy and he has a big maul and knocks you down, then this trigger will run.
ti_on_leave_area
No trigger parameters.
This trigger will run if the player exits a scene.
Interesting note: if you place commands inside a scene prop trigger, it will run on that scene prop alone. For example, if you use (play_sound, "snd_your_sound") in a scene prop trigger, the sound will play at that scene prop, not globally like that command usually does.
ti_on_scene_prop_init or ti_on_init_scene_prop
Trigger Parameter 1 - The prop instance (of the initialized prop).
This trigger will run when the prop initializes. For example, when it spawns.
ti_on_scene_prop_hit
Trigger Parameter 1 - The prop instance (of the prop which was just hit).
Trigger Parameter 2 - The damage of the hit.
Position Register 1 - Hit Position (where the hit landed on the scene prop).
Position Register 2 - Position of the attacker. X-axis of this position holds the attacker agent ID.
This trigger will run when a prop is hit. Interesting note: using (position_get_x, <destination>, pos2), will return you the attacker agents ID into <destination>.
Interesting note - if you do (position_get_x, ":attacker", pos2), then you must either set the fixed point multiplier to 1 before getting the :attacker variable.
ti_on_scene_prop_destroy
Trigger Parameter 1 - The prop instance (of the prop which was just destroyed).
This trigger will run if a scene prop is destroyed.
ti_on_scene_prop_use
Trigger Parameter 1 - The agent id (of the agent which just used the scene prop).
Trigger Parameter 2 - The prop instance (of the prop which was just used).
This trigger will run if a prop is used. For example, in multiplayer you can hold the F key down near the Winch prop to open the gate in the Village map.
ti_on_scene_prop_is_animating
Trigger Parameter 1 - The prop instance (of the prop which is animating).
Trigger Parameter 2 - Remaining animation time.
This trigger will run if a prop is animating.
ti_on_scene_prop_animation_finished
Trigger Parameter 1 - The prop instance (of the prop whose animation just ended).
This trigger will run if a scene prop finishes animation.
ti_on_scene_prop_init or ti_on_init_scene_prop
Trigger Parameter 1 - The prop instance (of the initialized prop).
This trigger will run when the prop initializes. For example, when it spawns.
ti_on_scene_prop_hit
Trigger Parameter 1 - The prop instance (of the prop which was just hit).
Trigger Parameter 2 - The damage of the hit.
Position Register 1 - Hit Position (where the hit landed on the scene prop).
Position Register 2 - Position of the attacker. X-axis of this position holds the attacker agent ID.
This trigger will run when a prop is hit. Interesting note: using (position_get_x, <destination>, pos2), will return you the attacker agents ID into <destination>.
Interesting note - if you do (position_get_x, ":attacker", pos2), then you must either set the fixed point multiplier to 1 before getting the :attacker variable.
ti_on_scene_prop_destroy
Trigger Parameter 1 - The prop instance (of the prop which was just destroyed).
This trigger will run if a scene prop is destroyed.
ti_on_scene_prop_use
Trigger Parameter 1 - The agent id (of the agent which just used the scene prop).
Trigger Parameter 2 - The prop instance (of the prop which was just used).
This trigger will run if a prop is used. For example, in multiplayer you can hold the F key down near the Winch prop to open the gate in the Village map.
ti_on_scene_prop_is_animating
Trigger Parameter 1 - The prop instance (of the prop which is animating).
Trigger Parameter 2 - Remaining animation time.
This trigger will run if a prop is animating.
ti_on_scene_prop_animation_finished
Trigger Parameter 1 - The prop instance (of the prop whose animation just ended).
This trigger will run if a scene prop finishes animation.
ti_on_init_item
Trigger Parameter 1 - The agent id (of the item wearer).
Trigger Parameter 2 - The troop id (of the item wearer).
This trigger will run if a item is initialized. For example, in the Inventory window or in scenes.
ti_on_weapon_attack
Position Register 1 - The weapon items position (of the weapon which just "attacked").
This trigger will run if a item is used. For example, if you shoot a crossbow.
It works only on ranged items.
ti_on_missile_hit
Trigger Parameter 1 - The shooter agent (who just fired the missile).
Position Register 1 - The position of the missile (which just landed somewhere).
This trigger will run if a missile lands somewhere. For example, if you shoot your bow and the arrow lands.
It works only on missiles themselves. It won't work on bows, crossbows and so on.
Trigger Parameter 1 - The agent id (of the item wearer).
Trigger Parameter 2 - The troop id (of the item wearer).
This trigger will run if a item is initialized. For example, in the Inventory window or in scenes.
ti_on_weapon_attack
Position Register 1 - The weapon items position (of the weapon which just "attacked").
This trigger will run if a item is used. For example, if you shoot a crossbow.
It works only on ranged items.
ti_on_missile_hit
Trigger Parameter 1 - The shooter agent (who just fired the missile).
Position Register 1 - The position of the missile (which just landed somewhere).
This trigger will run if a missile lands somewhere. For example, if you shoot your bow and the arrow lands.
It works only on missiles themselves. It won't work on bows, crossbows and so on.
ti_on_presentation_load
No trigger parameters.
This trigger will run on the initialization of a presentation.
ti_on_presentation_run
Trigger Parameter 1 - Stores the time of how long the presentation has run in milliseconds.
This trigger will run each millisecond/frame of the presentation.
ti_on_presentation_event_state_change
Trigger Parameter 1 - The ID of the Object at which a event just occurred.
Trigger Parameter 2 - Value (If available).
This trigger will run if a event occurs on a Object. For example, if you have made a Slider overlay and have it stored to the variable $slider, then when you change the Sliders value this trigger will run and the Trigger Parameter 1 will be $slider and Value will be the new value of the slider.
ti_on_presentation_mouse_enter_leave
Trigger Parameter 1 - The ID of the Object at which the mouse enters/leaves.
Trigger Parameter 2 - Mouse entered/leaved? Stores '0' if enters, '1' if leaves.
This trigger will run if a mouse enters or leaves a Object. For example, if you have made a Text Box overlay and have it stored to $tbox, then when you point the mouse at the overlay this trigger will run and the Trigger Parameter 1 will be $tbox and Trigger Parameter 2 will be 0.
ti_on_presentation_mouse_press
Trigger Parameter 1 - The ID of the Object at which the mouse is pressed.
Trigger Parameter 2 - Mouse key? Stores '0' if the left mouse button is pressed, '1' if the right mouse button and '2' if the middle mouse button.
This trigger will run if you press a mouse key at a Object. For example, you have made a Button overlay and stored it into $button, then when you press the left mouse button at the Button, this trigger will run and the Trigger Parameter 1 will be $button and Trigger Parameter 2 will be '0'.
No trigger parameters.
This trigger will run on the initialization of a presentation.
ti_on_presentation_run
Trigger Parameter 1 - Stores the time of how long the presentation has run in milliseconds.
This trigger will run each millisecond/frame of the presentation.
ti_on_presentation_event_state_change
Trigger Parameter 1 - The ID of the Object at which a event just occurred.
Trigger Parameter 2 - Value (If available).
This trigger will run if a event occurs on a Object. For example, if you have made a Slider overlay and have it stored to the variable $slider, then when you change the Sliders value this trigger will run and the Trigger Parameter 1 will be $slider and Value will be the new value of the slider.
ti_on_presentation_mouse_enter_leave
Trigger Parameter 1 - The ID of the Object at which the mouse enters/leaves.
Trigger Parameter 2 - Mouse entered/leaved? Stores '0' if enters, '1' if leaves.
This trigger will run if a mouse enters or leaves a Object. For example, if you have made a Text Box overlay and have it stored to $tbox, then when you point the mouse at the overlay this trigger will run and the Trigger Parameter 1 will be $tbox and Trigger Parameter 2 will be 0.
ti_on_presentation_mouse_press
Trigger Parameter 1 - The ID of the Object at which the mouse is pressed.
Trigger Parameter 2 - Mouse key? Stores '0' if the left mouse button is pressed, '1' if the right mouse button and '2' if the middle mouse button.
This trigger will run if you press a mouse key at a Object. For example, you have made a Button overlay and stored it into $button, then when you press the left mouse button at the Button, this trigger will run and the Trigger Parameter 1 will be $button and Trigger Parameter 2 will be '0'.
ti_on_init_map_icon Can only be used in module_map_icons.
Trigger Parameter 1 - The ID of the Party whose map icon was just initialized.
This trigger will run if a map icon is initialized.
Trigger Parameter 1 - The ID of the Party whose map icon was just initialized.
This trigger will run if a map icon is initialized.
cdvader