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...") |
SpeckBomber (talk | contribs) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | {{Page_WD2}} | ||
Retrieves the entity IDs of AI agents from the specified agent type. | Retrieves the entity IDs of AI agents from the specified agent type. | ||
Line 13: | Line 14: | ||
== 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> | ||
Line 62: | Line 65: | ||
== Related Pages == | == Related Pages == | ||
+ | * [[CAIAgentManager]] | ||
* [[Entity]] | * [[Entity]] | ||
* [[EntityId]] | * [[EntityId]] |
Latest revision as of 20:40, 27 October 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 |
... |