(info) Other great resources: Official JS API docs, Scripting Forum

donateObject()

Transfer an object to another player...

Hopefully this function will be renamed transferObject() in keeping with eventObjectTransfer().

 

Syntax

var success = donateObject(gameObj, to);

Parameters

ParameterTypeMandatoryNotesGame Version
gameObj

Game object

(tick)

The object to transfer.

Currently, you can only transfer a Droid object.

3.2
toNumber(tick)

The ID of the player who you want to transfer the object to.

3.2

Return value

ValueTypeNotesGame Version
trueBooleanThe object was successfully transferred.3.2
falseBooleanThe object could not be transferred because the recipient has reached their droid limits.3.2
<error>ErrorInvalid 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:

Â