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

eventPickup()

Triggered when an oil barrel or artifiact is picked up by a droid...

 

Syntax

function eventPickup(item, droid) {
	// do stuff
}

Parameters

ParameterTypeMandatoryNotesGame version
itemFeature object(tick)

The item that was picked up. You can look at its .stattype property to find out what it is:

3.2+
droidDroid object(tick)The droid that picked up the item.3.2+

Return value

Warzone does not process the return value of this event.

Notes

When an oil drum is picked up, the 100 power is automatically transferred to your reserves.

When an artifact is picked up, the technology it contains will become available for research - so it's worth checking to see if you have any labs idle. If you've already researched the technology, nothing will happen. It's not possible to determine what the technology is from the item parameter - it's name will always be "Artifact".

After picking up the item, the droid will become idle (assuming it's an AI-controlled droid that was ordered to pick the item up) and the item will be destroyed (removed from the map). Note that in eventDestroyed() the feature object's .player property will be the value of 'me', not 12.

In Warzone 3.1, you can determine when items are picked up as they will still trigger eventDestroyed(), however it's difficult to determine which droid (and which player) picked up the item.

Example

function eventPickup(item, droid) {
	switch (item.stattype) {
		case OIL_DRUM: return console("+100 power");
		case ARTIFACT: return console("New research available?");
	}
}
Availability 3.2+

Requires:

  • Warzone 3.2 or above
Contents

Jump to: