createUnit: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (expanded parameter description)
No edit summary
Line 16: Line 16:
____________________________________________________________________________________________
____________________________________________________________________________________________


| "ClassName" '''createUnit''' [ position, group, initialization, skill, rank] |= Syntax
| type '''createUnit''' [ position, group, init, skill, rank] |= Syntax
,init ([[String]]), skill ([[Number]]), rank ([[String]])]
,init ([[String]]), skill ([[Number]]), rank ([[String]])]


|p1= ClassName: [[String]] - Classname of unit to be createdas per cfgVehicles |= Parameter 1
|p1= type: [[String]] - Classname of unit to be created as per cfgVehicles |= Parameter 1
|p2= position: [[Position]] - Location unit is created at. |= Parameter 2
 
|p3= group: [[Group]] - Existing group new unit will join. |= Parameter 3
|p2= [ position, group, init, skill, rank]: [[Array]] |= Parameter 2
|p4= initialization: [[String]] - (optional, default "") Command to be executed upon creation of unit. |= Parameter 4
|p3= position: [[Position]] - Location unit is created at. |= Parameter 3
|p5= skill: [[Number]] - (optional, default 0.5) |= Parameter 5
|p4= group: [[Group]] - Existing group new unit will join. |= Parameter 4
|p6= rank: [[String]] - (optional, default "PRIVATE") |= Parameter 6
|p5= init: [[String]] - (optional, default "") Command to be executed upon creation of unit. |= Parameter 5
|p6= skill: [[Number]] - (optional, default 0.5) |= Parameter 6
|p7= rank: [[String]] - (optional, default "PRIVATE") |= Parameter 7


| [[Nothing]] |= Return value
| [[Nothing]] |= Return value

Revision as of 18:25, 21 January 2009

Hover & click on the images for description

Description

Description:
Create unit of a class that's defined in CfgVehicles. 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 [ position, group, init, skill, rank]
Parameters:
type: String - Classname of unit to be created as per cfgVehicles
[ position, group, init, skill, rank]: Array
position: Position - Location unit is created at.
group: Group - Existing group new unit will join.
init: String - (optional, default "") Command to be executed upon creation of unit.
skill: Number - (optional, default 0.5)
rank: String - (optional, default "PRIVATE")
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:
createUnit arraycreateCentercreateGroupcreateVehicle

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
To give a newly created unit a name, put "newUnit = this" in the init field.
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.
Posted on December 24, 2007 - 00:33
MulleDK13
If you do not wish it to be in a group, you can create a gamelogic and group it to that.
Note: The unit will deny to move away from the gamelogic.

Bottom Section