Other great resources: Official JS API docs, Scripting Forum
hackGetObj()
Retrieve a game object based on it's type, player and ID...
Syntax
var gameObj = hackGetObj(type, player, id);Parameters
Parameter | Type | Mandatory | Description | Game version |
|---|---|---|---|---|
type | Constant | The type of object to retrieve: | 3.2 | |
player | Number | The player to which the object belongs. When retrieving feature objects, specify player as | 3.2 | |
id | Number | The object ID. | 3.2 |
Return value
Value | Type | Description | Game version |
|---|---|---|---|
<gameObj> | The Droid object, Structure object or Feature object that was found. | 3.2 | |
| Null | The object was not found. | 3.2 |
<error> | Error | Invalid 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
}