Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning
titleUncertain future

It's not certain whether this function will change or be deprecated in future releases, so use with care.

Overview

Excerpt

Register a function to be called when a game object gets destroyed

...

This is incredibly useful because you can use it on objects owned by other players, and even destroyable features like trees.

...

.

To detect when your own objects are destroyed, it's easier to use eventDestroyed() because it avoids having to bind to individual objects.

Availability

3.1 Beta 1 and above.

Syntax

Code Block
themeEclipse
languagejavascript
linenumberstrue
bind(functionName, gameObject);

Parameters

ParameterTypeMandatoryDescriptionGame version
functionNameString(tick)The name of the function that should be called immediately before the gameObject is destroyed.3.1 Beta 1
gameObject

...

Game objects(tick)Any game object, such as a droid, structure or feature.3.1 Beta 1

Return value

ValueTypeDescriptionGame version
undefinedUndefinedIndicates the bind was successful.3.1 Beta 1
<error>ErrorIndicates there was a problem (did you remember to specify functionName as as a string?)3.1 Beta 1

Example

Code Block
themeEclipse
languagejavascript
titleDo something when someObject is destroyed
linenumberstrue
function certainDeath(gameObject) {
  // do stuff
}
 
bind("certainDeath", someObject); // where someObject 

...

is 

...

any 

...

See also

...

Game Object

Notes

This function is incredibly useful because you can use it on objects owned by other players, and even destroyable features like trees.

Your function will be triggered immediately before the game object is removed from the map.

To detect when your own objects are destroyed, it's easier to use eventDestroyed() because it avoids having to bind to individual objects.

Div
classbox notice ping

It's not certain whether this function will change or be deprecated in future releases, so use with care. 

Div
classbox
Availability
Status
colourYellow
titleUncertain

Requires:

  • Warzone 3.1 or above
Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

See also

Related articles: