createAgent: Difference between revisions
Jump to navigation
Jump to search
m (Bot: Reverted to revision 109266 by Dedmen on 2018-09-23T14:20:27Z) |
m (template:command argument fix) |
||
Line 11: | Line 11: | ||
Players assigned to an agent using [[setPlayable]] will be able to control the agent, operate weapons and other actions, but will not be able to access their inventory using the gear screen. | Players assigned to an agent using [[setPlayable]] will be able to control the agent, operate weapons and other actions, but will not be able to access their inventory using the gear screen. | ||
Special properties can be: "NONE", "CAN_COLLIDE" and "FORM". |= | Special properties can be: "NONE", "CAN_COLLIDE" and "FORM". |DESCRIPTION= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| '''createAgent''' [type, position, markers, placement, special] |= | | '''createAgent''' [type, position, markers, placement, special] |SYNTAX= | ||
|p1= [type, position, markers, placement, special]: [[Array]] |= | |p1= [type, position, markers, placement, special]: [[Array]] |PARAMETER1= | ||
|p2= type: [[String]] - class from [[CfgVehicles]] |= | |p2= type: [[String]] - class from [[CfgVehicles]] |PARAMETER2= | ||
|p3= position: [[PositionAGL]], [[Position2D]], [[Object]] - desired placement position|= | |p3= position: [[PositionAGL]], [[Position2D]], [[Object]] - desired placement position|PARAMETER3= | ||
|p4= 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. |= | |p4= 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. |PARAMETER4= | ||
|p5= placement: [[Number]] radius |= | |p5= placement: [[Number]] radius |PARAMETER5= | ||
|p6= special: [[String]] - "NONE", "FORM", "CAN_COLLIDE" |= | |p6= special: [[String]] - "NONE", "FORM", "CAN_COLLIDE" |PARAMETER6= | ||
| [[Object]] |= | | [[Object]] |RETURNVALUE= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <code>_agent = [[createAgent]] ["SoldierWB", [[position]] [[player]], [], 0, "FORM"];</code> |= | |x1= <code>_agent = [[createAgent]] ["SoldierWB", [[position]] [[player]], [], 0, "FORM"];</code> |EXAMPLE1= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[agent]], [[agents]], [[isAgent]], [[forEachMemberAgent]], [[execFSM]], [[BIS_fnc_execFSM]] |= | | [[agent]], [[agents]], [[isAgent]], [[forEachMemberAgent]], [[execFSM]], [[BIS_fnc_execFSM]] |SEEALSO= | ||
}} | }} |
Revision as of 14:36, 7 April 2019
Description
- Description:
- Creates an (independent) agent (person) of the given type (type is a name of a subclass of CfgVehicles). An agent does not have a group or leader or the standard soldier FSM associated with it -- for instance, an enemy soldier spawned as an agent has limited AI and will stand stupidly when fired upon -- which can be useful to limit the amount of AI processing being done in a mission with very large numbers of "AI". If the markers array contains several marker names, the position of a random one is used, otherwise, the given position is used. The unit is placed inside a circle with this position as its center and placement as its radius.
Players assigned to an agent using setPlayable will be able to control the agent, operate weapons and other actions, but will not be able to access their inventory using the gear screen. Special properties can be: "NONE", "CAN_COLLIDE" and "FORM". - Groups:
- Uncategorised
Syntax
- Syntax:
- createAgent [type, position, markers, placement, special]
- 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
- special: String - "NONE", "FORM", "CAN_COLLIDE"
- Return Value:
- Object
Examples
- Example 1:
_agent = createAgent ["SoldierWB", position player, [], 0, "FORM"];
Additional Information
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
Bottom Section
- 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.31.127383 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.