agents: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "[[Category:Scripting_Commands_Take_On_Helicopters" to "[[Category:Scripting Commands Take On Helicopters") |
Lou Montana (talk | contribs) m (Text replacement - "\<dt class\=\"note\"\>\'\'\'\[\[(.*)\]\]\'\'\'" to "<dt class="note">$1") |
||
Line 35: | Line 35: | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on April 4, 2012 - 10:48 (GMT) | <dd class="notedate">Posted on April 4, 2012 - 10:48 (GMT) | ||
<dt class="note"> | <dt class="note">[[User:Rocket|Rocket]] | ||
<dd class="note">Note that agents returns a reference to the agent itself, not the object. For example: '''{alive _x} count agents;''' would return an error. But you can assign the agent a reference using setVariable, and then reference it, for example: '''{alive (_x getVariable ["agentObject",objNull]) count agents;''' would return the number of agents still alive - BUT you would need to define "agentObject" after you create the agent, for example: | <dd class="note">Note that agents returns a reference to the agent itself, not the object. For example: '''{alive _x} count agents;''' would return an error. But you can assign the agent a reference using setVariable, and then reference it, for example: '''{alive (_x getVariable ["agentObject",objNull]) count agents;''' would return the number of agents still alive - BUT you would need to define "agentObject" after you create the agent, for example: | ||
'''_agent = createAgent [_type, _position, [], _radius, "NONE"];_agent setVariable["agentObject",_agent,true];''' | '''_agent = createAgent [_type, _position, [], _radius, "NONE"];_agent setVariable["agentObject",_agent,true];''' | ||
<dd class="notedate">Posted on August 1, 2013 - 21:55 (GMT) | <dd class="notedate">Posted on August 1, 2013 - 21:55 (GMT) | ||
<dt class="note"> | <dt class="note">[[User:Killzone_Kid|Killzone_Kid]] | ||
<dd class="note">Alternatively, to get object from agent reference use [[agent]] command. | <dd class="note">Alternatively, to get object from agent reference use [[agent]] command. | ||
<!-- Note Section END --> | <!-- Note Section END --> |
Revision as of 16:02, 17 May 2020
Description
- Description:
- Return a list of agents in the current mission.
- Groups:
- Uncategorised
Syntax
- Syntax:
- agents
- Return Value:
- Array of Team Members
Examples
Additional Information
- See also:
- agentcreateAgentisAgentforEachMemberAgententitiesallCuratorsallGroupsallDeadplayableUnitsswitchableUnitsvehiclesallUnitsUAVallDeadMen
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
- Posted on April 4, 2012 - 10:48 (GMT)
- Rocket
- Note that agents returns a reference to the agent itself, not the object. For example: {alive _x} count agents; would return an error. But you can assign the agent a reference using setVariable, and then reference it, for example: {alive (_x getVariable ["agentObject",objNull]) count agents; would return the number of agents still alive - BUT you would need to define "agentObject" after you create the agent, for example: _agent = createAgent [_type, _position, [], _radius, "NONE"];_agent setVariable["agentObject",_agent,true];
- Posted on August 1, 2013 - 21:55 (GMT)
- Killzone_Kid
- Alternatively, to get object from agent reference use agent command.