createUnit

From Bohemia Interactive Community

Jump to: navigation, search
Editors, please check Policy: Scripting Command Page Syntax.
Introduced in Operation Flashpoint version 1.34Arguments of this scripting command don't have to be local to the client the command is executed onEffects of this scripting command are broadcasted over the network and happen on every computer in the network

Click on the images for descriptions

Introduced in

Game:
Operation Flashpoint
Version:
1.34

Description

Description:
Create unit of given Classname from a CfgVehicles addon

The Group parameter MUST be an existing group or the unit won't be created.

Syntax

Syntax:
"ClassName" createUnit [ Position, Group, "init", skill, rank]
Parameters:
ClassName: String - Classname of unit to be createdas per cfgVehicles
Position
Group
init: String Optional. Default ""
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

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.
See also:
createUnit array, createCenter, createGroup, createVehicle

Notes

Notes

+ Add Note

Only post proven facts here. Use the talk page or the forums for discussions.

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.
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

Personal tools
Buy ArmA now!