Other great resources: Official JS API docs, Scripting Forum
donateObject()
- Aubergine
Owned by Aubergine
Transfer an object to another player...
Hopefully this function will be renamed transferObject() in keeping with eventObjectTransfer().
Â
Syntax
var success = donateObject(gameObj, to);
Parameters
Parameter | Type | Mandatory | Notes | Game Version |
---|---|---|---|---|
gameObj | The object to transfer. Currently, you can only transfer a Droid object. | 3.2 | ||
to | Number | The ID of the player who you want to transfer the object to. | 3.2 |
Return value
Value | Type | Notes | Game Version |
---|---|---|---|
true | Boolean | The object was successfully transferred. | 3.2 |
false | Boolean | The object could not be transferred because the recipient has reached their droid limits. | 3.2 |
<error> | Error | Invalid parameters or object/player not found. | 3.2 |
Notes
If your script is requesting an object, it should check that it's not reached it's limits for that object first.
If you want to check whether the other player has reached their limits before you try to transfer an object, use getDroidLimit() or getStructureLimit().
Both players will receive eventObjectTransfer() after the object is transferred.
Example
Transfer a truck to player 4
var truck = enumDroid( me, DROID_CONSTRUCT )[0]; Â donateObject( truck, 4 );
Availability 3.2+
Requires:
- Warzone 3.2 or above
Contents
Jump to:
See also
Related articles:
- eventObjectTransfer() – triggered when an object is transferred to or from another player
- donatePower() – transfer some power to another player
- getDroidLimit() – work out if a player has reached their droid limits
- getStructureLimit() – work out if a player has reached their structure limits
Â