Other great resources: Official JS API docs, Scripting Forum
bind()
- Aubergine
Owned by Aubergine
Register a function to be called when a game object gets destroyed.
Â
Syntax
bind(functionName, gameObject);
Parameters
Parameter | Type | Mandatory | Description | Game version |
---|---|---|---|---|
functionName | String | The name of the function that should be called immediately before the gameObject is destroyed. | 3.1 Beta 1 | |
gameObject | Game objects | Any game object, such as a droid, structure or feature. | 3.1 Beta 1 |
Return value
Value | Type | Description | Game version |
---|---|---|---|
undefined | Undefined | Indicates the bind was successful. | 3.1 Beta 1 |
<error> | Error | Indicates there was a problem (did you remember to specify functionName as as a string?) | 3.1 Beta 1 |
Notes
To detect when your own objects are destroyed, use eventDestroyed() instead.
This function is 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.
Example
Do something when someObject is destroyed
function certainDeath(gameObject) { // do stuff } Â bind("certainDeath", someObject); // where someObject is any Game Object
Removed in Warzone 3.2.
Availability 3.1 B1→3.1.0
Requires:
- Warzone 3.1 Beta 1 → 3.1.0
- Removed in 3.2
Later versions:
- In Warzone 3.2 and above, use eventDestroyed() which is updated to trigger for any object owned by any player.
Contents
Jump to:
See also
Related articles:
- eventAttacked() – triggered when one of your units or structures is attacked
- eventDestroyed() – triggered when one of your units or structures is destroyed
- Game objects – objects which you can bind()
Â