Class: TriggerZone

Class contents

Methods list

These are special functions (or methods) that you may call on the object. these functions typically instruct the object to perform a certain operation.
    No methods

Public properties list

Properties are attributes of the object, this directly affect the object in question. Some of them can be read or written, or both.
Name Type Description
name string The name of the object

Events list

Events are functions you add to your objects, that will be called by Cubiverse when certain things (events) occur.

Class Information

Constructor

new TriggerZone()

Creates an instance of a TriggerZone, which is passed to the registerTriggerZone API call to register it with Cubiverse.

This should normally be created inside a "Trigger Zone", which is added to the world using the World Editor.

The registerTriggerZone() API call required to register a TriggerZone is only available from inside the TriggerZone script, therefore it is pointless to create a TriggerZone outside it. Creating multiple TriggerZones objects in JS should also not be attempted as Cubiverse only creates a single TriggerZone for every one that exists in the world.

This:

Properties:

Name Type Description
name string The name of the object

Events

onPlayerEnter

Called when a player enters a TriggerZone

This event is trigger when any player enters a TriggerZone, it will be fired for each any every player that enters a zone. The event will fire only once, but will refire if a player enters, leaves and then re-enters a zone.

Parameters:
Name Type Description
playerObject object The actual playerObject that has entered the zone
Example
// Print the player nickName to the debug console when they enter the zone
myTriggerZone.prototype.onPlayerEnter = function( playerObject )
{
   this.log("Player " + playerObject.nickName + " has entered the zone") ;
}

onPlayerLeave

Called when a player leaves a TriggerZone

This event is trigger when any player leaves a TriggerZone, it will be fired for each any every player that leaves a zone. The event will fire only once, but will refire if a player leaves, leaves and then re-leaves a zone.

Parameters:
Name Type Description
playerObject object The actual playerObject that has leaveed the zone
Example
// Print the player nickName to the debug console when they leave the zone
myTriggerZone.prototype.onPlayerLeave = function( playerObject )  
{
   this.log("Player " + playerObject.nickName + " has left the zone") ;
}