Versions Compared

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
themeRDark
languagejavascript
linenumberstrue
function eventObjectSeen(sensor, gameObject) {
  // do stuff
}

Parameters

ParameterTypeMandatoryDescriptionGame version
sensor

Structure object

Droid object

(tick)The structure or droid that was responsible for detecting the new object on the map.3.1 Beta 2
gameObject

Game object

(tick)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
themeRDark
languagejavascript
titleFilter seen objects by type
linenumberstrue
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
classbox notice ping

Currently this event only reports objects spotted by your sensors. It does not get triggered when allies spot something.

Div
classbox
Availability
Status
colourGreen
title
Stable
3.1 b2+

Requires:

  • Warzone 3.1 Beta 2 or above
Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

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