Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

Retrieve a game object based on it's ID...

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
var gameObj = objFromId(idObj); // use with care!!

Parameters

ParameterTypeMandatoryDescriptionGame version
idObjObject(tick)

An object that has an .id property who's value is the ID of the object you wish to retrieve.

For example, if you want to retrieve object #63, you'd pass in: {id:63}

You could also pass in a cached Game object to get a fresh copy of that game object (all game objects have an .id property).

3.1 Beta 2

Return value

ValueTypeDescriptionGame version
<gameObj>Game objectA Droid object, Structure object or Feature object that has the specified object id.3.1 Beta 2
nullNullThe object was not found.3.1 Beta 2
<error>ErrorDue to bugs, if object is not found an error is usually thrown.3.1 Beta 2

Example

Code Block
themeRDark
languagejavascript
titleAlways wrap calls to objFromId() in try...catch blocks...
linenumberstrue
var lookingFor = {id:63};
var found;
 
try {
	found = objFromId(lookingFor);
} catch(e) {
	found = null;
}
 
if (found) {
	// do stuff with 'found' game object
}
Div
classnotice box ping

This function is deprecated as of Warzone 3.2.

Div
classbox smallstatus
Availability
Status
colourRed
title3.1 b2→3.1.0

Requires:

  • Warzone 3.1 Beta 2 → 3.1.0

Replaced by:

Older Earlier versions:

Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

See also

Related articles: