eventObjectSeen()

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

eventObjectSeen()

This event is triggered when one of your sensors detects something new on the map.

 

Syntax

function eventObjectSeen(sensor, gameObject) { // do stuff }

Parameters

Parameter

Type

Mandatory

Description

Game version

sensor

Structure object

Droid object

The structure or droid that was responsible for detecting the new object on the map.

3.1 Beta 2

gameObject

Game object

The object that was detected - either a Structure object, Droid object or Feature object.

3.1 Beta 2

Return value

Warzone does not process the event handler's return value.

Notes

The event is throttled, meaning that it won't get triggered for all newly detected objects, just some of them.

If you want to get a list of all droids that are currently visible, use enumDroid().

Example

Filter seen objects by type
function eventObjectSeen(sensor, gameObject) { switch (gameObject.type) { case STRUCTURE: { if (!allianceExistsBetween(me,gameObject.player)) { console(sensor.name+" spotted an enemy structure: "+gameObject.name); } } case DROID: { if (!allianceExistsBetween(me,gameObject.player)) { console(sensor.name+" spotted an enemy droid: "+gameObject.name); } } case FEATURE: { console(sensor.name+" spotted a "+gameObject.name); } } }

 

Comments