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 3 Next »

Retrieve a game object based on it's type, player and ID...

 

Syntax

var gameObj = hackGetObj(type, player, id);

Parameters

ParameterTypeMandatoryDescriptionGame version
typeConstant(tick)

The type of object to retrieve:

3.2
playerNumber(tick)

The player to which the object belongs.

When retrieving feature objects, specify player as -1.

3.2
idNumber(tick)

The object ID.

3.2

Return value

ValueTypeDescriptionGame version
<gameObj>Game objectThe Droid object, Structure object or Feature object that was found.3.2
nullNullThe object was not found.3.2
<error>ErrorInvalid parameters specified.3.2

Example

Always wrap calls to objFromId() in try...catch blocks...
var obj = hackGetObj(DROID, me, 63); // retrieve my droid #63
 
if (obj) {
	// do stuff with the obj
}
This function has an uncertain future so use with caution!
Availability 3.2+

Requires:

  • Warzone 3.2 and above

Earlier versions:

Contents

Jump to:

See also

Related articles:

 

  • No labels