Other great resources: Official JS API docs, Scripting Forum
eventObjectTransfer()
- Aubergine
Owned by Aubergine
This event is triggered when a droid or structure is transferred to or from another player...
Â
Syntax
function eventObjectTransfer(gameObject, from) { // do stuff }
Parameters
Parameter | Type | Mandatory | Description | Game version |
---|---|---|---|---|
gameObject | The object that was transferred. It's | 3.1 Beta 2 | ||
from | Number | The ID of the player who lost the object. You can find out more about them in the playerData[] array. | 3.1 Beta 2 |
Return value
Warzone does not process your event handler's return value.
Notes
Common scenarios for this happening are:
- Unit assimilated by a Nexus Link turret
- Droids transferred between players using donateObject() or Transfers via in-game UI.
The event is triggered after the object is transferred, so the objects'Â .player
 property will indicate who now owns it.
Both players will receive the event (not that it matters much to your script).
If the object was in a group, it will be removed from the group. On Warzone 3.2 or above, that will trigger eventGroupLoss().
Example
Handle all possible scenarios
eventObjectTransfer(gameObject, from) { if (gameObject.player == me) { // I gained a new object if (allianceExistsBetween(me,from)) { // a gift from an ally // do stuff } else { // probably Nexus Link assimilated it from an enemy // do stuff } } else { // I lost an object if (allianceExistsBetween(gameObject.player,from)) { // I gave a droid to my ally // do stuff } else { // looks like an enemy Nexus Link assimilated one of my droids :( // do stuff } } }
Availability 3.1 B2+
Requires:
- Warzone 3.2 Beta 2 or above
Contents
Jump to:
See also
Related articles:
- donateObject() – transfer an object between players
- allianceExistsBetween() – determine whether the transfer was with an ally or not
- eventDroidBuilt() – triggered when a new droid is built at your factory (or just unexpectedly appears out of thin air)
- eventStructureBuilt() – triggered when a new structure is built
Â