createUnit: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 50: Line 50:
<dt class="note">'''[[User:Raedor|raedor]]'''</dt><dd class="note">Does not return anything. To give a newly created unit a name, put "newUnit = this" in the init.</dd>
<dt class="note">'''[[User:Raedor|raedor]]'''</dt><dd class="note">Does not return anything. To give a newly created unit a name, put "newUnit = this" in the init.</dd>
<dd class="notedate">Posted on 18:41, 5 April 2007 (CEST)</dd>
<dd class="notedate">Posted on 18:41, 5 April 2007 (CEST)</dd>
<dt class="note">'''[[User:Shuko|Shuko]]'''</dt><dd class="note">The eventhandlers added with [[addEventHandler]] in the init field will only fire locally on the machine where this creation command is called from.</dd>
<dt class="note">'''[[User:Shuko|Shuko]]'''</dt><dd class="note">The eventhandlers added with [[addEventHandler]] in the init parameter will only fire locally on the machine where this creation command is called from.</dd>
<!-- Note Section END -->
<!-- Note Section END -->
</dl>
</dl>

Revision as of 17:48, 5 April 2007

Hover & click on the images for description

Description

Description:
Create unit of given type. Format of unitInfo is: [pos (Position), group (Group),init (String), skill (Number), rank (String)] init, skill and rank are optional, default values are: "", 0.5, "PRIVATE". The Group parameter MUST be an existing group or the unit won't be created.
Multiplayer:
The code in init is executed on all connected clients in multiplayer. It can therefore be used to get around the publicVariable limitation of not being able to send strings and arrays over the network.
Groups:
Uncategorised

Syntax

Syntax:
type createUnit unitInfo
Parameters:
type: String - Classname of unit to be created
unitInfo: Array
Return Value:
Nothing

Examples

Example 1:
"SoldierWB" createUnit [position player, group player]
Example 2:
"soldierWB" createUnit [getMarkerPos "barracks", groupAlpha]
Example 3:
"soldierWB" createUnit [getMarkerPos "marker_1", groupAlpha,"loon1 = this ;
 this addweapon {binocular}", 0.6, "corporal"]

Additional Information

See also:
createVehiclecreateUnit arraycreateVehicle arraycreateVehicleLocaldeleteVehicle

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 August 13, 2006 - 12:32
raedor
Does not return anything. To give a newly created unit a name, put "newUnit = this" in the init.
Posted on 18:41, 5 April 2007 (CEST)
Shuko
The eventhandlers added with addEventHandler in the init parameter will only fire locally on the machine where this creation command is called from.

Bottom Section