Difference between revisions of "createUnit"

From Bohemia Interactive Community
Jump to navigation Jump to search
(some info about differences between both syntaxes)
m
Line 14: Line 14:
 
However, some commands such as [[setUnitPos]] only work if run before the [[join]].}}<br>
 
However, some commands such as [[setUnitPos]] only work if run before the [[join]].}}<br>
 
{{Warning|The unit won't be created '''if the passed group doesn't exist''' (a.k.a [[grpNull]]); this can happen if [[createGroup]] fails because the '''group limit has been reached'''.}}<br>
 
{{Warning|The unit won't be created '''if the passed group doesn't exist''' (a.k.a [[grpNull]]); this can happen if [[createGroup]] fails because the '''group limit has been reached'''.}}<br>
Alt Syntax is the older syntax and differs 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 newer syntax allows creating units in remote groups, which could be unsafe and the appropriate warning is logged into ''.rpt'' file: <tt>Warning: Adding units to a remote group is not safe. Please use [[setGroupOwner]] to change the group owner first.</tt> |Description=
+
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 newer syntax allows creating units in remote groups, which could be unsafe and the appropriate warning is logged into ''.rpt'' file: <tt>Warning: Adding units to a remote group is not safe. Please use [[setGroupOwner]] to change the group owner first.</tt> |Description=
 
____________________________________________________________________________________________
 
____________________________________________________________________________________________
  

Revision as of 18:35, 18 March 2019

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