GetObjectsByType
The GetObjectsByType API is used to pull all objects out of the object manager that match the type passed to it as a variable. The type is specified by an integer value. For example:
| Type | Description | Type | Description |
|---|---|---|---|
| 0 | CGObject | 8 | CGGameObject |
| 1 | CGItem | 9 | CGDynamicObject |
| 2 | CGContainer | 10 | CGCorpse |
| 3 | CGAzeriteEmpoweredItem | 11 | CGAreaTrigger |
| 4 | CGAzeriteItem | 12 | CGSceneObject |
| 5 | CGUnit | 13 | CGConversation |
| 6 | CGPlayer | 14 | AiGroup |
| 7 | CGActivePlayer | 15 | Scenario |
A full list of object types is available online.
Usage
LUA Example
Here is an example of how to use the GetObjectsByType API in LUA:
local api = ...
-- Define the object type you want to retrieve
local objectType = 8 -- For objects
-- Call the GetObjectsByType API
local objects = api.GetObjectsByType(objectType)
-- Iterate through the returned objects and print their names
for index, obj in ipairs(objects) do
if obj then
print("Object# " .. index .. " Name: " .. api.GetObjectName(obj))
end
end