Game logic - Event listener – Ylands

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
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=
===Execution limit===
*Number of times event listener can be triggered, -1 sets to infinite.


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


=Interaction With Entity=
===Instigated by===
*Target -  specifies the source of event the listener is waiting for.
*Available when ''Player interaction with entity'' set
**Any Entity - any entity performing selected event will trigger the listener.
*Distinguishes who can trigger the listener
**Entity Type - only picked entity type performing selected event will trigger the listener.
**'''Any player''' - any player will trigger the listener
**Specific Entity - one specifically selected entity performing selected event will trigger the  listener.
**'''Labeled player''' - player with certain Label
**Labeled Entities - any entity of given Label performing selected event will trigger the listener.
**'''Player role''' - only specific player role will trigger the listener


=Player interaction with entity=
===Target===
*Instigated by - distinguishes who can trigger the listener
*Specifies the source of event the listener is waiting for.
**Any player - any player will trigger the listener
**'''Any Entity''' - any entity performing selected event will trigger the listener.
**Player role - only specific player role will trigger the listener
**'''Entity Type''' - only picked entity type performing selected event will trigger the listener.
**Labeled player - player with certain Label
**'''Specific Entity''' one specifically selected entity performing selected event will trigger the listener.
*Target same as above
**'''Labeled Entities''' - any entity of given Label performing selected event will trigger the listener.
*Activate on - for player instigated events
**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
===Activate on===
**Damage - triggers if player causes damage to an entity
*Available when ''Player interaction with entity'' set
**Destroy - triggers when a player removes all the remaining HP from an entity
**'''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)


=Events=
===Interaction===
*On Trigger
*Depends on the type of selected target entity, there are 2 default ones
**Trigger object - instigator of the event (e.g player who opened the door)
**'''Damage''' - triggers if player causes damage to an entity
**Target object - source of the event (e.g door)
**'''Destroy''' - triggers when a player removes all the remaining HP from an entity


=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.




----
----
{{Ylands scripting navbox}}
{{Ylands scripting navbox}}

Revision as of 22:36, 2 December 2018

Description

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

Properties

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 interaction with entity - Adds possibility to disgusting who can trigger the listener.

Instigated by

  • Available when Player interaction with entity set
  • Distinguishes who can trigger the listener
    • Any player - any player will trigger the listener
    • Labeled player - player with certain Label
    • Player role - only specific player role will trigger the listener

Target

  • Specifies the source of event the listener is waiting for.
    • Any Entity - any entity performing selected event will trigger the listener.
    • Entity Type - only picked entity type performing selected event will trigger the listener.
    • Specific Entity - one specifically selected entity performing selected event will trigger the listener.
    • Labeled Entities - any entity of given Label performing selected event will trigger the listener.

Activate on

  • Available when Player interaction with entity set
    • 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
    • Damage - triggers if player causes damage to an entity
    • Destroy - triggers when a player removes all the remaining HP from an entity

Event listener events



Template:Ylands scripting navbox