Game logic - Event listener – Ylands

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "=Description= Waits for certain type of event happening in the game world. =Properties= *Execution limit - number of times event listener can be triggered, -1 sets to infini...")
 
m (Text replacement - "{{DEFAULTSORT:{{#sub:{{PAGENAME}}|19}}}}" to "{{DEFAULTSORT:{{#sub:{{PAGENAME}}|13}}}}")
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Description=
=Description=
Event listener is a special trigger, which is waiting for certain event to occur and then triggers.


Waits for certain type of event happening in the game world.
= Properties =
[[File:{{PAGENAME}}.png|right|400px|Properties]]
=== Enabled ===
*Defines whenever the trigger is activated or not.


=Properties=
=== Execution limit ===
*Execution limit - number of times event listener can be triggered, -1 sets to infinite.
*Number of times event listener can be triggered, -1 sets to infinite.
**Listen for - type of event listen for, supported events are:
**Interaction with entity - Waits for a interaction occurring on target entity regardless the instigator.
**Player interaction with entity - Adds possibility to disgusting who can trigger the listener.


=Interaction With Entity=
=== Listen for ===
*Target -  specifies the source of event the listener is waiting for.
*Type of event to listen for, supported events are:
**Any Entity - any entity performing selected event will trigger the listener.
**'''Interaction with entity''' - Waits for a interaction occurring on target entity regardless the instigator.
**Entity Type - only picked entity type performing selected event will trigger the listener.
**'''Player action''' - Waits for specific player action (e.g On Jump)
**Specific Entity - one specifically selected entity performing selected event will trigger the listener.
**'''Player interaction with entity''' - Adds possibility to disgusting who can trigger the listener.
**Labeled Entities - any entity of given Label performing selected event will trigger the listener.
**'''Player interaction with 2 entities''' - Special variant for events with 2 targets (e.g. Link / Unlink energy)


=Player interaction with entity=
=== Instigated by ===
*Instigated by - distinguishes who can trigger the listener
*Available for player interactions.
**Any player - any player will trigger the listener
*Distinguishes who can trigger the listener:
**Player role - only specific player role will trigger the listener
**'''Any player''' - any player will trigger the listener
**Labeled player - player with certain Label
**'''Labeled player''' - player with specific [[Ylands:Game logic - Entity label|entity label]]
*Target - same as above
**'''Player role''' - only players with specific [[Ylands:Game logic - Player role|player role]] will trigger the listener
*Activate on - for player instigated events
**'''Player team''' - only players of specific [Ylands Game logic - Player team|player team]] will trigger the listener
**Start - will trigger at the moment player starts doing an action. (e.g starts unpacking sleeping pad)
**End - will trigger at the moment player finishes doing an action. (e.g sleeping pad is unpacked)
**Blocked - will trigger if player tries to do action but he can not do it. (e.g tries open a locked chest)
**Interrupted - will trigger if player interrupts doing an action (e.g starts extracting resin but do not complete that)


*Interaction - depends on the type of selected target entity, there are 2 default ones
=== Target ===
**Damage triggers if player causes damage to an entity
*Specifies the source of event the listener is waiting for.
**Destroy - triggers when a player removes all the remaining HP from an entity
**'''Any entity''' - any entity.
**'''Entity class''' -  specific entity class as selected from drop down menu.
**'''Entity type''' -  specific entity type, type is defined by picking an entity from scene, entity can be then deleted.
**'''Specific entity''' one selected entity.
**'''Labeled entities''' -  any entity with selected [[Ylands:Game logic - Entity label|entity label]].


=Events=
=== Events ===
*On Trigger
*Defines which actions / interactions (events) the listener will wait for. It is possible to set listener to react to more that 1 event.
**Trigger object - instigator of the event (e.g player who opened the door)
**Target object - source of the event (e.g door)


=Event Listener in Use=
= Event listener events =
# Select Event Listener from the game logic tab and place it.
*[[Ylands:Tile - Event Listener On Trigger|On Trigger]]
# Open properties of the Listener by double-clicking it. Set-up the conditions which trigger the following script. In this case, Listener is used for executing a script after selected knife is being picked up from a tree trunk.
# Open the edit script window. To start creating the script, start with triggering event "On Trigger", than set-up the following script. In this case, after the knife is picked up, script causes the tree to thank the player for doing that.


= Related instructions =
*[[Ylands:Tile - Game logic enabled|Get / Set Enabled]]


{{Game logic List}}
 
----
{{Navbox/Ylands}}
{{DEFAULTSORT:{{#sub:{{PAGENAME}}|13}}}}
 
[[Category: Game Logic]]
[[Category: Ylands 0.12]]

Latest revision as of 15:21, 24 November 2023

Description

Event listener is a special trigger, which is waiting for certain event to occur and then triggers.

Properties

Enabled

  • Defines whenever the trigger is activated or not.

Execution limit

  • Number of times event listener can be triggered, -1 sets to infinite.

Listen for

  • Type of event to listen for, supported events are:
    • Interaction with entity - Waits for a interaction occurring on target entity regardless the instigator.
    • Player action - Waits for specific player action (e.g On Jump)
    • Player interaction with entity - Adds possibility to disgusting who can trigger the listener.
    • Player interaction with 2 entities - Special variant for events with 2 targets (e.g. Link / Unlink energy)

Instigated by

  • Available for player interactions.
  • Distinguishes who can trigger the listener:
    • Any player - any player will trigger the listener
    • Labeled player - player with specific entity label
    • Player role - only players with specific player role will trigger the listener
    • Player team - only players of specific [Ylands Game logic - Player team|player team]] will trigger the listener

Target

  • Specifies the source of event the listener is waiting for.
    • Any entity - any entity.
    • Entity class - specific entity class as selected from drop down menu.
    • Entity type - specific entity type, type is defined by picking an entity from scene, entity can be then deleted.
    • Specific entity - one selected entity.
    • Labeled entities - any entity with selected entity label.

Events

  • Defines which actions / interactions (events) the listener will wait for. It is possible to set listener to react to more that 1 event.

Event listener events

Related instructions