Versions Compared

Key

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

Get an object based on it's object ID and player ID...

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
var gameObj = droidFromId( id, player );

Parameters

ParameterTypeMandatoryNotesGame version
idNumber(tick)The ID of the object to retrieve3.1 Beta 1 ONLY
playerNumber(tick)The ID of the player to which the object belongs.3.1 Beta 1 ONLY

Return values

ValueTypeNotesGame version
<gameObj>Game object

If the object is found, it's associated game object is returned.

Despite the name of the function, droidFromId() was capable of getting any type of game object, including structures and features.

3.1 Beta 1 ONLY
<error>ErrorIf the object is not found, an error is thrown.3.1 Beta 1 ONLY

Example

Code Block
themeRDark
languagejavascript
titleGet object with id #63 that belongs to me
linenumberstrue
var obj;
try {
	obj = droidFromId( 63, me );
	// do stuff with obj that was found
} catch(e) {
	// object not found
}
Div
classbox
Availability
Status
colourRed
title3.1 b1

Requires:

  • Warzone 3.1 Beta 1 only

Later versionsReplaced by:

  • On Warzone 3.1 Beta 2 → 3.1.0 use objFromId2+ use getObject()
  • On Warzone 3.2 early developer releases, use hackGetObj()
  • On Warzone 3.2+, use hackGetObj1 Beta 2 → 3.1.0 use objFromId()
Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

See also

Related articles: