Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
This event is triggered when one of your sensors detects something new on the map. |
Syntax
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
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
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
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); } } } |
Div | ||
---|---|---|
| ||
Currently this event only reports objects spotted by your sensors. It does not get triggered when allies spot something. |
Div | |||||||
---|---|---|---|---|---|---|---|
| |||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||
---|---|---|
| ||
See alsoRelated articles:
|