Difference between revisions of "createUnit"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (see also create3denentitiy)
m (Text replacement - "{{arma}}" to "{{arma1}}")
Line 13: Line 13:
 
| Create a unit of class that is defined in [[:Category:CfgVehicles|CfgVehicles]].
 
| Create a unit of class that is defined in [[:Category:CfgVehicles|CfgVehicles]].
 
{{Important | <div style{{=}}"float: left; margin-right: 0.5em;">{{GVI|ofp|1.34}} {{GVI|arma|1.00}}</div>
 
{{Important | <div style{{=}}"float: left; margin-right: 0.5em;">{{GVI|ofp|1.34}} {{GVI|arma|1.00}}</div>
This command could be bugged in {{ofp}} or {{arma}} ; an additional [[join]] may solve the problem.<br>
+
This command could be bugged in {{ofp}} or {{arma1}} ; an additional [[join]] may solve the problem.<br>
 
However, some commands such as [[setUnitPos]] only work if run before the [[join]].}}
 
However, some commands such as [[setUnitPos]] only work if run before the [[join]].}}
 
{{Warning | The unit will not be created if the passed group does not exist (a.k.a [[grpNull]]); this can happen if [[createGroup]] fails because the '''group limit has been reached''' (see [[createGroup]] for respective game limits).}} |Description=
 
{{Warning | The unit will not be created if the passed group does not exist (a.k.a [[grpNull]]); this can happen if [[createGroup]] fails because the '''group limit has been reached''' (see [[createGroup]] for respective game limits).}} |Description=

Revision as of 07:38, 26 December 2020

Template:Command

Notes

Posted on 27th Nov 2016
Ffur2007slx2_5
Arma 3 logo black.png1.64 The side of the created unit by this command uses its config's side and not the side of a passed empty group created by createGroup: _grp = createGroup east; hint str side _grp; // EAST _ap = _grp createUnit [ "C_man_p_beggar_F", position player, [], 0, "FORM"]; hint str side _ap; // CIV, not EAST We can use join command or fill the _grp with entities in advance to set _ap to the desired side.
Posted on 8th Dec 2018
oOKexOo
Since Arma 3 logo black.png1.86: If you want to place a module with createUnit, you have to ensure that the module gets activated automatically by setting BIS_fnc_initModules_disableAutoActivation to false, e.g: private _grp = createGroup sideLogic; "ModuleSmokeWhite_F" createUnit [ getPos player, _grp, "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];" ];
Posted on 18th Mar 2019
Killzone_Kid
Alt Syntax is the older syntax and differs in functionality from the main, newer syntax. The main difference is that the older syntax does not return unit reference. This is because the unit created with Alt Syntax is created strictly where passed group is local. This means that if the group is remote the unit will be created on the different client than the one the command was executed on and therefore it is not possible to return created unit reference immediately. In contrast, the newer syntax allows creating units in remote groups while returning unit reference immediately, which could be unsafe and the appropriate warning is logged into .rpt file: Warning: Adding units to a remote group is not safe. Please use setGroupOwner to change the group owner first.

Another very important difference is that the older syntax (Alt Syntax) will create unit of the same side as the side of the group passed as argument. For example, if the group is WEST and the unit faction is OPFOR of type, say "O_Soldier_GL_F", the unit created will be on the WEST side as well. In contrast, newer syntax will create the same unit on the EAST side in the WEST group, which will be treated as hostile by other group members and eliminated.

Template:Warning
Posted on June 19, 2020 - 10:13 (UTC)
fusselwurm
Arma 3 logo black.png1.98 note that even when setting the placement special parameter to "NONE", 3DEN-placed objects are being ignored when looking for a free position. In other words: units will spawn within editor-placed rocks or under houses.