Game logic - Event listener – Ylands
Jump to navigation
Jump to search
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 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
- 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.
Player interaction with entity
- Instigated by - distinguishes who can trigger the listener
- Any player - any player will trigger the listener
- Player role - only specific player role will trigger the listener
- Labeled player - player with certain Label
- Target - same as above
- 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
- Damage - triggers if player causes damage to an entity
- Destroy - triggers when a player removes all the remaining HP from an entity
Events
- On Trigger
- 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
- Select Event Listener from the game logic tab and place it.
- 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.