Skip to content

TriggerAreaDetectionPlayerTrigger ​

Inherits: EventTrigger < Resource

Triggers when a player-controlled entity enters or exits a detection trigger area

Properties ​

inttrigger_area_id0
TriggerModetrigger_modeTriggerMode.ON_ENTER
PlayerTargetplayer_targetPlayerTarget.CURRENT_PLAYER

Variables ​

Stringtrigger_area_name""
TriggerAreatarget_trigger_areanull

Methods ​

Stringget_display_name()
Stringget_function_description()
voidsetup()
voidcleanup()
voidfind_target_trigger_area()
voidconnect_trigger_area_signals()
voiddisconnect_trigger_area_signals()
boolis_matching_player( body: Node3D )
boolis_triggered( event_data: Dictionary )
Stringgenerate_objective_description()

Enumerations ​

enum TriggerMode ​

The options of trigger mode: on enter, on exit, on both.

  • ON_ENTER = 0
  • ON_EXIT = 1
  • ON_BOTH = 2

enum PlayerTarget ​

Reuse PlayerTarget enum from PlayerEventTrigger

  • CURRENT_PLAYER = 0
  • ALL_PLAYERS = 1
  • PLAYER_1 = 2
  • PLAYER_2 = 3
  • PLAYER_3 = 4
  • PLAYER_4 = 5
  • PLAYER_5 = 6
  • PLAYER_6 = 7
  • PLAYER_7 = 8
  • PLAYER_8 = 9
  • PLAYER_9 = 10
  • PLAYER_10 = 11
  • PLAYER_11 = 12
  • PLAYER_12 = 13
  • PLAYER_13 = 14
  • PLAYER_14 = 15
  • PLAYER_15 = 16
  • PLAYER_16 = 17
  • PLAYER_17 = 18
  • PLAYER_18 = 19
  • PLAYER_19 = 20
  • PLAYER_20 = 21

Property descriptions ​

int trigger_area_id = 0 ​

The trigger area ID to track

TriggerMode trigger_mode = TriggerMode.ON_ENTER ​

When to trigger (enter, exit, or both)

PlayerTarget player_target = PlayerTarget.CURRENT_PLAYER ​

Which player(s) to detect

Variable descriptions ​

String trigger_area_name = "" ​

Trigger area name - auto-populated from the target trigger area if it exists

TriggerArea target_trigger_area = null ​

Reference to the target Trigger area

Method descriptions ​

String get_display_name() ​

The name of the trigger in the editor.

String get_function_description() ​

The sentence the editor shows for the trigger, with {placeholders} for its values.

void setup() ​

Starts listening: connects the signals the trigger waits for.

void cleanup() ​

Stops listening: disconnects the signals of the trigger.

void find_target_trigger_area() ​

Finds the trigger area the trigger watches by its id.

void connect_trigger_area_signals() ​

Connects the signals of the trigger area (an entity enters, an entity leaves).

void disconnect_trigger_area_signals() ​

Disconnects the signals of the trigger area.

bool is_matching_player( body: Node3D ) ​

Is the body a player entity?

bool is_triggered( event_data: Dictionary ) ​

Does this event data satisfy the trigger? Called when the signal the trigger listens to fires.

String generate_objective_description() ​

The line of the quest objective this trigger makes ("Kill 5 wolves").