Other great resources: Official JS API docs, Scripting Forum

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Overview

Returns an array of all enemy structures of a given type, optionally filtered to visibility of lookingPlayer.

Availability

Warzone 3.1 Beta 1 and above.

(warning) Requires getEnemyPlayerIDs()

Code

function enumEnemyStruct(structure,viewer) {
  var list = [];
  var enemies = getEnemyPlayerIDs();
  enemies.forEach(function(enemy) {
    if (!!viewer) {
      list = list.concat(enumStruct(enemy,structure,viewer));
    } else {
      list = list.concat(enumStruct(enemy,structure));
    }
  });
  return list;
}

Example

// get a list of enemy oil derricks
var enemyDerricks = enumEnemyStruct(RESOURCE_EXTRACTOR);

See also

  • No labels