Language

onTrigger


onTrigger(string name, boolean state)

Description

onTrigger() is a callback function. This function can be called for several reasons:

Parameters

name
The name of the entity which has triggered the callback.
state
The state of the trigger. Take a look on entity page for further details. Example: state is true when player enter a trigger and false is he exists it.

Examples

Play a sound

  1. function onTrigger(name, state)
  2.     if name == "triggerBoss" and state then
  3.         Sound.play("youWillDie.ogg", true)
  4.     end
  5. end