createAgent

From Bohemia Interactive Community
Revision as of 21:29, 9 June 2021 by Lou Montana (talk | contribs) (Text replacement - " \| arma2 \| *([0-9]\.[0-9]{2}) * " to " | arma2 |$1 |game2= arma2oa |version2= 1.50 |game3= tkoh |version3= 1.00 |game4= arma3 |version4= 0.50 ")
Jump to navigation Jump to search
Hover & click on the images for description

Description

Description:
Description needed
Groups:
Object Manipulation

Syntax

Syntax:
Syntax needed
Parameters:
[type, position, markers, placement, special]: Array
type: String - class from CfgVehicles
position: PositionAGL, Position2D, Object - desired placement position
markers: Array - if the markers array contains any markers, the position is randomly picked from array of given markers plus desired placement position. If any of the markers were given z coordinate with setMarkerPos, the vehicle will also be created at given z coordinate.
placement: Number radius, the unit is randomly place in a circle with this radius
special: String - one of:
  • "NONE" - will look for a suitable empty position near given position (subject to other placement params) before creating the agent
  • "CAN_COLLIDE" - creates the agent at given position (subject to other placement params), without checking if others objects can cross its 3D model
Return Value:
Return value needed

Examples

Example 1:
private _agent = createAgent ["B_Soldier_F", getPosATL player, [], 0, "FORM"];

Additional Information

See also:
agentagentsisAgentforEachMemberAgentexecFSMBIS_fnc_execFSM

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
Posted on September 29, 2014 - 20:03 (UTC)
Killzone Kid
In Arma 3, default FSM is calling BIS_fnc_animalBehaviour script upon agent creation, which takes on some animal behavioural logic. The problem here is that it is almost impossible to make animal do what is told. Until now. Since Arma 3 v1.32 you can set BIS_fnc_animalBehaviour_disable variable on the agent at the moment of agent creation, to override the function. tr = createTrigger ["EmptyDetector", player modelToWorld [0, 10, 0]]; tr setTriggerArea [5, 5, 0, true]; tr setTriggerActivation ["CIV", "PRESENT", true]; rabbits = []; private "_r"; for "_i" from 1 to 10 do { _r = createAgent ["Rabbit_F", position tr, [], 0, "NONE"]; _r setVariable ["BIS_fnc_animalBehaviour_disable", true]; rabbits pushBack _r; }; tr setTriggerStatements [ "if (rabbits isEqualTo thisList) exitWith { _r = thisList select floor random count thisList; _r moveTo (_r modelToWorld [2.5 - random 5, 2.5 - random 5, 0]); }; _esc = rabbits - thisList; doStop _esc; {_x moveTo position thisTrigger} forEach _esc; systemChat str [time, _esc]; false", "", "" ];
Posted on April 18, 2015 - 07:17 (UTC)
Waffle SS.
Agents seem to use the same collision model that the player uses, unlike normal AI. Normal AI don't collide with objects, but agents are physically stopped by obstacles the same way players are. This also probably means agents cost more resources than normal AI.