Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

eventObjectTransfer(object, from)

An event that is run whenever an object is transferred between players, for example due to a Nexus Link weapon. The event is called after the object has been transferred, so the receiving player is in object.player. The event is called for both players.

object = Droid object (most common) or Structure object (i've never seen this happen but apparently it can?!)

...

Excerpt

This event is triggered when a droid or structure is transferred to or from another player...

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
function eventObjectTransfer(gameObject, from) {
  // do stuff
}

Parameters

ParameterTypeMandatoryDescriptionGame version
gameObject

Droid object

Structure object

(tick)

The object that was transferred.

It's .player property indicates who now owns it.

3.1 Beta 2
fromNumber(tick)

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:

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

Code Block
themeRDark
languagejavascript
titleHandle all possible scenarios
linenumberstrue
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
    }
  }
}
Div
classbox
Availability
Status
colourGreen
title3.1 b2+

Requires:

  • Warzone 3.2 Beta 2 or above
Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

See also

Related articles: