agents: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(example fixed)
Line 18: Line 18:
|p3= |= PARAMETER3  
|p3= |= PARAMETER3  


| [[Array]] |= RETURNVALUE  
| [[Array]] of [[Team Member|Team Members]]|= RETURNVALUE  




|x1= <code>{_x doWatch player} forEach agents;</code>|= EXAMPLE1  
|x1= <code>{agent _x moveTo position player} forEach '''agents''';</code>|= EXAMPLE1  


____________________________________________________________________________________________
____________________________________________________________________________________________

Revision as of 13:50, 13 June 2013

Hover & click on the images for description

Description

Description:
Return a list of agents in the current mission.
Groups:
Uncategorised

Syntax

Syntax:
agents
Return Value:
Array of Team Members

Examples

Example 1:
{agent _x moveTo position player} forEach agents;

Additional Information

See also:
agentcreateAgentisAgentforEachMemberAgent

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];

Bottom Section