Other great resources: Official JS API docs, Scripting Forum
eventObjectSeen()
- Aubergine
Owned by Aubergine
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 | The structure or droid that was responsible for detecting the new object on the map. | 3.1 Beta 2 | ||
gameObject | 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); } } }
Currently this event only reports objects spotted by your sensors. It does not get triggered when allies spot something.
Availability 3.1 B2+
Requires:
- Warzone 3.1 Beta 2 or above
Contents
Jump to:
See also
Related articles:
- enumBlips() – get a list of enemy sensor and ECM structures that your Radar Detector has seen
- enumDroid() – can be used to get a list of droids that you or your allies can see
- enumFeature() – can be used to get a list of features that you or your allies can see
- enumStruct() – can be used to get a list of structures that you or your allies can see
Â