Difference between revisions of "CAIAgentManager:GetAIAgentsOfGroupFromLUA v2"
From Nomad DB
(Created page with "Retrieves the entity IDs of AI agents from the specified agent type. == Syntax == <syntaxhighlight lang="lua"> CAIAgentManager_GetInstance():GetAIAgentsOfGroupFromLUA_v2(agen...") |
|||
Line 13: | Line 13: | ||
== Example == | == Example == | ||
− | + | Retrieves AI agent entities that are part of the SFPD and are hostile towards the player. | |
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
− | + | local agentsList = CAIAgentManager_GetInstance():GetAIAgentsOfGroupFromLUA_v2("Human", 1, "", 1, 1) | |
+ | local str = table.concat(agentsList, ", ") | ||
+ | print(str) -- returns a string containing the entity IDs of the specified agents | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 16:23, 15 April 2020
Retrieves the entity IDs of AI agents from the specified agent type.
Syntax
CAIAgentManager_GetInstance():GetAIAgentsOfGroupFromLUA_v2(agentType, affiliation, group, health, hostility)
- agentType (string): Target AI agent type
- affiliation (number): Target AI agent affiliation
- group (string): currently unknown, usually empty string
- health (number): Target AI agent health state
- hostility (number): Target AI agent hostility type
- Returns (table): Table containing entity IDs
Example
Retrieves AI agent entities that are part of the SFPD and are hostile towards the player.
local agentsList = CAIAgentManager_GetInstance():GetAIAgentsOfGroupFromLUA_v2("Human", 1, "", 1, 1)
local str = table.concat(agentsList, ", ")
print(str) -- returns a string containing the entity IDs of the specified agents
Parameters
Type
Name |
---|
All |
Human |
... |
Health
ID | State |
---|---|
0 | Alive |
1 | Any |
... |
Hostility
ID | State |
---|---|
0 | Any |
1 | Enemy |
2 | Not Enemy |
... |