Events and Context: Difference between revisions
m formatting |
m formatting |
||
| Line 698: | Line 698: | ||
| | | | ||
|- | |- | ||
|event_zone_usable | |<code>event_zone_usable</code> | ||
|<code>array</code> - Array[ZoneCore] | |<code>array</code> - Array[ZoneCore] | ||
<code>string</code> - name of action | <code>string</code> - name of action | ||
Revision as of 17:20, 27 July 2026
The Events System
Lancer is a system famous for its numerous reactions and counter-reactions. In Lancer Tactics, this is handled by generating EventCore objects and then queueing them to each other in one big stack. EventCores each have an EventBase resource in their base variable, which defines the type of event it is. The EventCore object is typically called activation, event or core.
Olive's devlog on the subject (which you should check out just for the meme).
Execution Sequence
- Run the
execute_preblock()function for the event's EventBase:
• For events which can be reacted to, fetch the events for every reaction with timing
ReactionBus.TIMING.PRE.• The reaction events are ordered according to their priority (low to high).
• Loop through the reaction events and run the whole execution sequence for each reaction event in turn.
- If the event is aborted (
event.aborted == true), or the Context object does not contain the required data, execution stops here. - Run the
execute()function for the event's EventBase:
• Executes any functionality the event has (for example, clearing heat for an
event_unit_cool).• For events which can be reacted to, fetch the events for every reaction with timing
ReactionBus.TIMING.POST.• The reaction events are ordered according to their priority (low to high). • Loop through the reaction events and run the whole execution sequence for each reaction event in turn.
- Run child events:
• These are events queued to the EventCore with
event.queue_event().• The child events are ordered according to their priority (low to high).
• Loop through the child events and run the whole execution sequence for child event in turn.
Context
Data is passed between events within a Context object, which contains any parameters an event needs in order to execute. The Context is checked by an event immediately before calling its execute() function to see if it is able to run. Reactions with ReactionBus.TIMING. PRE can modify the Context of the event they are reacting to before the event itself occurs, which allows them to change the event's behavior.
Whether the Context object contains a specific variable can be queried using the context.is_property_present() function.
The Context objects contains the following variables:
| Variable | Type | Additional Info |
|---|---|---|
action
|
Action | See Actions and Reactions. |
array
|
Array | |
boolean
|
bool | |
buff
|
BuffCore | |
category
|
Variant | Represents an enum or id string. |
category_int
|
int | The category variable, typed as an int. Setting this will modify the category variable.
|
category_string
|
StringName | The category variable, typed as a StringName. Setting this will modify the category variable.
|
event
|
EventCore | Usually the parent event of the current event. |
flags
|
Array | Usually contains enums. |
gear
|
GearCore | |
map
|
MapState | Always populated. |
number
|
int | |
object
|
Variant | |
resource
|
Resource | |
string
|
String | |
target_tiles
|
Array[Vector2i] | |
target_tile
|
Vector2i | target_tiles[0], or Tile.INVALID if it is empty. Setting this will add the Vector2i to target_tiles at index 0.
|
target_units
|
Array[Unit] | |
target_unit
|
Unit | target_units[0], or null if it is empty. Setting this will add the Unit to target_units at index 0.
|
unit
|
Unit |
Event Creation
A Context object is usually created from a dictionary, where each key corresponds to the name of a variable:
var context = Context.create({
string = "Example Context",
boolean = true
})
Events are almost always created using the functions on their parent event, although it is possible to create one directly to make a virtual event not queued to any other event.
An event can be queued to the activation event with:
activation.queue_event(&"event_example_id", {
string = "Example Event",
boolean = true
}, Priority.ACTIVATE.late_followup)
Events can also be executed immediately:
await activation.execute_event(&"event_example_id", {
string = "Example Event",
boolean = true
})
As with any other await function, check your references are not null before proceeding.
Event Types
The scripts defining the game's events can be found in the res://content/events/ folder.
Events with Reactions
| Event ID | Required Context | Optional Context | Reactions |
|---|---|---|---|
event_combat_end
|
boolean - victory?
|
combat_end
| |
event_combat_set_state
|
string
|
modified_combat_state
| |
event_combat_start
|
combat_start
| ||
event_combat_trigger_signal
|
string
|
number
|
trigger_signal
|
event_gear_activate
|
unit
|
target_tiles - targeting hint
|
unit_action - generates a fake Context matching that of event_unit_action. Context cannot be modified by PRE events
|
event_gear_destroy
|
unit
|
gear_destruction
| |
event_gear_reload
|
unit
( and/or
|
reload
| |
event_map_damage
|
target_tiles
|
flags - EventMapDamage.FLAG
|
terrain_damage
|
event_round_new
|
new_round
| ||
event_turn_end
|
unit
|
end_turn
| |
event_turn_start
|
unit
|
new_turn
| |
event_unit_action
|
unit
|
target_tiles
|
executes an event_gear_activate which in turn runs unit_action reactions with a context matching this event
|
event_unit_apply_status
|
unit
|
string - persistent id of source gear
|
statuses_changed (only PRE)
|
event_unit_attack
|
target_unit - attacked unit
|
flags - Action.FLAG
|
attack
|
event_unit_attack_declared
|
unit
|
attack_declared
| |
event_unit_boost
|
unit
|
event
|
boost
|
event_unit_brace
|
unit
|
brace
| |
event_unit_clear_status
|
unit
|
string - persistent id of source gear
|
statuses_changed (only POST)
|
event_unit_collide
|
unit
|
collision
| |
event_unit_cool
|
unit
|
clear_heat
| |
event_unit_damage
|
unit
|
category - Lancer.DAMAGE_TYPE - default kinetic
|
damage
|
event_unit_die
|
unit
|
flags - EventService.DIE_FLAG
|
death
|
event_unit_exile
|
unit
|
string - persistent id of source gear
|
exiled
|
event_unit_intangible
|
unit
|
string - persistent id of source gear
|
intangible
|
event_unit_lose_hidden
|
unit
|
lose_hidden
| |
event_unit_meltdown
|
unit
|
meltdown
| |
event_unit_move
|
unit
( or
|
resource - MovementType
|
step
|
event_unit_save
|
target_unit
|
unit - origin unit
|
forced_save
|
event_unit_spawn
|
unit
|
number - direction (0-3)
|
unit_spawn
|
event_unit_stress
|
unit
|
flags - EventService.STRESSED_FLAG
|
stressed
|
event_unit_structure
|
unit
|
flags - EventService.STRUCTURED_FLAG
|
structured
|
Other Events
| Event ID | Required Context | Optional Context |
|---|---|---|
event_buff_activate
|
buff
|
|
event_camera_move
|
target_tiles - moves so it can see all these
|
number - move speed in milliseconds, 0 by default
|
event_camera_set_locked
|
boolean
|
flags
|
event_combat_banner_intro
|
||
event_combat_highlight_ui
|
boolean
|
flags - GoldenPathHighlight.AUTO_CLEAR
|
event_combat_set_objective
|
number - index of objective to change
|
string - objective text
|
event_combat_set_round_max
|
number
|
|
event_combat_set_triggers_enabled
|
string - name of trigger group
|
|
event_delay
|
number - milliseconds
|
|
event_dialogue
|
string - conversation id
|
unit - for dynamic text
|
event_dialogue_bark
|
unit
|
target_units - for dynamic text
|
event_dialogue_emoji
|
unit
|
number - length to show in milliseconds
|
event_dialogue_face
|
unit
|
|
event_gear_choose_and_use
|
unit
|
boolean - is overwatch?
(if Action.FLAG.TARGETS_ARE_MANDATORY:
|
event_map_block_add
|
target_tiles
|
flags - EventMapBlockAdd.FLAG
|
event_map_block_remove
|
target_tiles
|
flags - EventMapBlockAdd.FLAG
|
event_map_dangerous
|
unit
|
resource - MovementType
|
event_map_doodad_add
|
target_tiles
|
number - rotation (0-3)
|
event_map_doodad_remove
|
target_tiles
|
|
event_map_effect
|
string - FXGroup id
|
target_tiles
|
event_map_setpiece_add
|
target_tiles
|
number - rotation (0-3)
|
event_map_setpiece_remove
|
target_tiles
|
|
event_map_set_water
|
number - elevation
|
|
event_map_text
|
string
|
flags
|
event_map_weather_toggle
|
string - weather id
|
|
event_music_play
|
string - fmod event path
|
flags
|
event_music_stop
|
||
event_round_end
|
||
event_round_set_next_faction
|
category - Faction.SIDE
|
|
event_unit_attach
|
unit
|
|
event_unit_deploy
|
resource - UnitCore
|
number - direction (0-3)
|
event_unit_extract
|
unit
|
flags - EventUnitExtract.FLAG
|
event_unit_faction
|
unit
|
flags - flags[0] is Lancer.UNTIL
|
event_unit_heal
|
unit
|
|
event_unit_mount
|
unit
|
flags
|
event_unit_overkill
|
unit
|
|
event_unit_overshield
|
unit
|
|
event_unit_pick_move
|
target_unit
|
(target_tiles - Array[Vector2i] - tiles for Pathfinder
or
|
event_unit_rename
|
unit
|
|
event_unit_set_stat
|
unit
|
|
event_unit_sitrep_tag
|
unit
|
|
event_unit_teleport
|
unit
|
|
event_zone_equip
|
string - kit id
|
|
event_zone_launch
|
array - Array[ZoneCore]
|
|
event_zone_reinforce
|
string - reinforcement group id or name
|
flags - EventZoneReinforce.FLAG
|
event_zone_setup
|
array - Array[ZoneCore]
|
string - zone name
|
event_zone_set_guides
|
array - Array[ZoneCore]
|
flags - Zone.GUIDE
|
event_zone_set_name
|
array - Array[ZoneCore]
|
|
event_zone_set_properties
|
array - Array[ZoneCore]
|
string - zone name
|
event_zone_set_type
|
array - Array[ZoneCore]
|
|
event_zone_set_visible
|
array - Array[ZoneCore]
|
|
event_zone_usable
|
array - Array[ZoneCore]
|
target_units - unit whitelist
|
Module Events
TODO
| Event ID | Required Context | Optional Context |
|---|---|---|