Events and Context: Difference between revisions

From The Muse
GavstarB (talk | contribs)
m finished first two event types table
GavstarB (talk | contribs)
m formatting
Line 235: Line 235:
|<code>unit</code>
|<code>unit</code>
<code>string</code> - kit id
<code>string</code> - kit id
<code>number</code> - action index
<code>number</code> - action index
|<code>target_tiles</code>
|<code>target_tiles</code>
<code>target_units</code>
<code>target_units</code>
<code>flags</code> - Action.FLAG
<code>flags</code> - Action.FLAG
<code>gear</code>
<code>gear</code>
<code>action</code>
<code>action</code>
|executes an <code>event_gear_activate</code> which in turn runs <code>unit_action</code> reactions with a context matching this event
|executes an <code>event_gear_activate</code> which in turn runs <code>unit_action</code> reactions with a context matching this event
Line 246: Line 250:
|<code>unit</code>
|<code>unit</code>
<code>category</code>
<code>category</code>
<code>flags</code>
<code>flags</code>
|<code>string</code> - persistent id of source gear
|<code>string</code> - persistent id of source gear
Line 295: Line 300:
|<code>unit</code>
|<code>unit</code>
<code>target_tiles</code> - tile collided with
<code>target_tiles</code> - tile collided with
<code>event</code>
<code>event</code>
|
|
Line 368: Line 374:
|<code>unit</code> - origin unit
|<code>unit</code> - origin unit
<code>gear</code> - origin gear
<code>gear</code> - origin gear
<code>action</code> - origin action
<code>action</code> - origin action
<code>string</code> - combat state key for success boolean to be saved to
<code>string</code> - combat state key for success boolean to be saved to
|<code>forced_save</code>
|<code>forced_save</code>
Line 425: Line 433:
<code>boolean</code> - is complete?
<code>boolean</code> - is complete?
|<code>string</code> - objective text
|<code>string</code> - objective text
<code>array</code> - [2,4] => "Search all zones! (2/4)"
<code>array</code> - [2,4] -> "Search all zones! (2/4)"


<code>flags</code>
<code>flags</code>
Line 512: Line 520:
|<code>target_tiles</code>
|<code>target_tiles</code>
<code>target_units</code>
<code>target_units</code>
<code>boolean</code> - wait for effect to end
<code>boolean</code> - wait for effect to end
|-
|-
Line 557: Line 566:
|<code>unit</code>
|<code>unit</code>
<code>target_units</code>
<code>target_units</code>
<code>boolean</code> - attach or release
<code>boolean</code> - attach or release
|
|
Line 600: Line 610:
|(<code>target_tiles</code> - Array[Vector2i] - tiles for Pathfinder
|(<code>target_tiles</code> - Array[Vector2i] - tiles for Pathfinder
'''or'''
'''or'''
<code>number</code> - movement budget)
<code>number</code> - movement budget)
<code>array</code> - Array[Vector2i] - knockback origin tiles
<code>array</code> - Array[Vector2i] - knockback origin tiles
<code>unit</code> - origin unit
<code>unit</code> - origin unit
<code>gear</code> - origin gear
<code>gear</code> - origin gear
<code>action</code> - origin action
<code>action</code> - origin action
|-
|-
Line 609: Line 624:
|<code>unit</code>
|<code>unit</code>
<code>string</code>
<code>string</code>
<code>category</code> - FetcherNameType.WHICH_NAME
<code>category</code> - FetcherNameType.WHICH_NAME
|
|
Line 615: Line 631:
|<code>unit</code>
|<code>unit</code>
<code>category</code> - Statblock.PROP
<code>category</code> - Statblock.PROP
<code>number</code>
<code>number</code>
|
|
Line 621: Line 638:
|<code>unit</code>
|<code>unit</code>
<code>string</code> - sitrep tag to add/remove
<code>string</code> - sitrep tag to add/remove
<code>boolean</code>
<code>boolean</code>
|
|
Line 642: Line 660:
|<code>string</code> - reinforcement group id or name
|<code>string</code> - reinforcement group id or name
<code>number</code> - number of units to deploy
<code>number</code> - number of units to deploy
<code>array</code> - Array[ZoneCore]
<code>array</code> - Array[ZoneCore]
|<code>flags</code> - EventZoneReinforce.FLAG
|<code>flags</code> - EventZoneReinforce.FLAG
Line 648: Line 667:
|<code>array</code> - Array[ZoneCore]
|<code>array</code> - Array[ZoneCore]
<code>category</code> - Zone.TYPE
<code>category</code> - Zone.TYPE
<code>boolean</code> - is visible
<code>boolean</code> - is visible
|<code>string</code> - zone name
|<code>string</code> - zone name
Line 664: Line 684:
|<code>array</code> - Array[ZoneCore]
|<code>array</code> - Array[ZoneCore]
<code>category</code> - Zone.TYPE
<code>category</code> - Zone.TYPE
<code>flags</code>
<code>flags</code>
|<code>string</code> - zone name
|<code>string</code> - zone name
Line 680: Line 701:
|<code>array</code> - Array[ZoneCore]
|<code>array</code> - Array[ZoneCore]
<code>string</code> - name of action
<code>string</code> - name of action
<code>object</code> - desc of action (String)
<code>object</code> - desc of action (String)
|<code>target_units</code> - unit whitelist
|<code>target_units</code> - unit whitelist

Revision as of 17:19, 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

object

modified_combat_state
event_combat_start combat_start
event_combat_trigger_signal string number

boolean

unit

object

array - if given, emits the signal more than once for each item in the array

trigger_signal
event_gear_activate unit

gear

action

target_tiles - targeting hint

target_units - targeting hint

event - parent event during reactions

flags - Action.FLAG

object - Pathfinder if can move before taking action

string - id of variant Action to be used

unit_action - generates a fake Context matching that of event_unit_action. Context cannot be modified by PRE events

stabilize

event_gear_destroy unit

gear

gear_destruction
event_gear_reload unit

(gear

and/or

array - Array[GearCore])

reload
event_map_damage target_tiles

number

flags - EventMapDamage.FLAG

object - elevation to destroy down to (int)

boolean - set to true if terrain got destroyed

terrain_damage
event_round_new new_round
event_turn_end unit end_turn
event_turn_start unit new_turn
event_unit_action unit

string - kit id

number - action index

target_tiles

target_units

flags - Action.FLAG

gear

action

executes an event_gear_activate which in turn runs unit_action reactions with a context matching this event
event_unit_apply_status unit

category

flags

string - persistent id of source gear

gear - source

statuses_changed (only PRE)
event_unit_attack target_unit - attacked unit

unit - attacking unit

gear

action

resource - DeclaredAttackSummary

event - event_unit_attack_declared

flags - Action.FLAG attack
event_unit_attack_declared unit

gear

action

resource - DeclaredAttackSummary

attack_declared
event_unit_boost unit event boost
event_unit_brace unit brace
event_unit_clear_status unit

category

string - persistent id of source gear

gear - source

statuses_changed (only POST)
event_unit_collide unit

target_tiles - tile collided with

event

collision
event_unit_cool unit

number

clear_heat
event_unit_damage unit

number

category - Lancer.DAMAGE_TYPE - default kinetic

object - AttackRoll

flags - EventService.DAMAGE_FLAG

target_unit - attacker

gear - attacker gear

action - attacker Action

damage
event_unit_die unit flags - EventService.DIE_FLAG death
event_unit_exile unit

flags - Lancer.UNTIL

string - persistent id of source gear

gear - source

exiled
event_unit_intangible unit

flags - Lancer.UNTIL

string - persistent id of source gear

gear - source

intangible
event_unit_lose_hidden unit lose_hidden
event_unit_meltdown unit meltdown
event_unit_move unit

(target_tiles - path or single tile to path to. in PRE reactions to step, holds the tile the unit is about to step into

or

array - Array[Pathfinder.Step] - final path)

resource - MovementType

flags - EventUnitMove.FLAG

object - SpecificAction which caused the move

step

entire_movement

event_unit_save target_unit

category - Lancer.HASE

unit - origin unit

gear - origin gear

action - origin action

string - combat state key for success boolean to be saved to

forced_save
event_unit_spawn unit

target_tiles - spawns units to all tiles in the array

number - direction (0-3)

flags - EventUnitSpawn.FLAG

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

unit - the unit the buff is applied to.

event - the event which triggered the activation.

event_camera_move target_tiles - moves so it can see all these number - move speed in milliseconds, 0 by default

flags

event_camera_set_locked boolean flags
event_combat_banner_intro
event_combat_highlight_ui boolean

string - compcon_id(?)

flags - GoldenPathHighlight.AUTO_CLEAR
event_combat_set_objective number - index of objective to change

boolean - is complete?

string - objective text

array - [2,4] -> "Search all zones! (2/4)"

flags

event_combat_set_round_max number
event_combat_set_triggers_enabled string - name of trigger group

boolean

event_delay number - milliseconds
event_dialogue string - conversation id unit - for dynamic text

target_units - for dynamic text

event_dialogue_bark unit

string - line id or raw text

target_units - for dynamic text

flags

event_dialogue_emoji unit

category - Emoji.TYPE

number - length to show in milliseconds
event_dialogue_face unit

target_tiles - tiles to look at

event_gear_choose_and_use unit

gear

action

array - Array[SpecificAction] - actions to pick from

boolean - is overwatch?

string - variant action id if mandatory

flags - Action.FLAG

(if Action.FLAG.TARGETS_ARE_MANDATORY:

target_units - mandatory targets

target_tiles - mandatory targets)

event_map_block_add target_tiles

category - block id (int)

number - elevation

flags - EventMapBlockAdd.FLAG
event_map_block_remove target_tiles

number - elevation

flags - EventMapBlockAdd.FLAG
event_map_dangerous unit

category - Lancer.DAMAGE_TYPE - type of damage to do on failure

resource - MovementType
event_map_doodad_add target_tiles

category - doodad id

number - rotation (0-3)

flags

event_map_doodad_remove target_tiles
event_map_effect string - FXGroup id target_tiles

target_units

boolean - wait for effect to end

event_map_setpiece_add target_tiles

category - setpiece id

number - rotation (0-3)

flags

event_map_setpiece_remove target_tiles
event_map_set_water number - elevation
event_map_text string

target_tiles

flags
event_map_weather_toggle string - weather id

boolean

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

target_units

boolean - attach or release

event_unit_deploy resource - UnitCore

target_tiles

number - direction (0-3)

flags - EventUnitSpawn.FLAG

event_unit_extract unit flags - EventUnitExtract.FLAG
event_unit_faction unit

category - Faction.SIDE

flags - flags[0] is Lancer.UNTIL
event_unit_heal unit

number

event_unit_mount unit

target_tiles

flags
event_unit_overkill unit

number

event_unit_overshield unit

number

event_unit_pick_move target_unit

resource - MovementType

(target_tiles - Array[Vector2i] - tiles for Pathfinder

or

number - movement budget)

array - Array[Vector2i] - knockback origin tiles

unit - origin unit

gear - origin gear

action - origin action

event_unit_rename unit

string

category - FetcherNameType.WHICH_NAME

event_unit_set_stat unit

category - Statblock.PROP

number

event_unit_sitrep_tag unit

string - sitrep tag to add/remove

boolean

event_unit_teleport unit

target_tiles

event_zone_equip string - kit id

array - Array[ZoneCore]

event_zone_launch array - Array[ZoneCore]

flags - EventUnitSpawn.FLAG

event_zone_reinforce string - reinforcement group id or name

number - number of units to deploy

array - Array[ZoneCore]

flags - EventZoneReinforce.FLAG
event_zone_setup array - Array[ZoneCore]

category - Zone.TYPE

boolean - is visible

string - zone name

flags - Zone.GUIDE

event_zone_set_guides array - Array[ZoneCore] flags - Zone.GUIDE
event_zone_set_name array - Array[ZoneCore]

string - zone name

event_zone_set_properties array - Array[ZoneCore]

category - Zone.TYPE

flags

string - zone name
event_zone_set_type array - Array[ZoneCore]

category - Zone.TYPE

event_zone_set_visible array - Array[ZoneCore]

boolean - is visible

event_zone_usable array - Array[ZoneCore]

string - name of action

object - desc of action (String)

target_units - unit whitelist

flags - EventZoneUsable.FLAG

Module Events

TODO

Event ID Required Context Optional Context