createUnit: Difference between revisions
Jump to navigation
Jump to search
Dr Eyeball (talk | contribs) (value of this) |
No edit summary |
||
Line 53: | Line 53: | ||
<dd class="notedate">Posted on December 24, 2007 - 00:33</dd> | <dd class="notedate">Posted on December 24, 2007 - 00:33</dd> | ||
<dt class="note">'''[[User:MulleDK13|MulleDK13]]'''</dt><dd class="note">If you do not wish it to be in a group, you can create a gamelogic and group it to that.<br>Note: The unit will deny to move away from the gamelogic.</dd> | <dt class="note">'''[[User:MulleDK13|MulleDK13]]'''</dt><dd class="note">If you do not wish it to be in a group, you can create a gamelogic and group it to that.<br>Note: The unit will deny to move away from the gamelogic.</dd> | ||
<dd class="notedate">Posted on May 24, 2009 - 00:33</dd> | |||
<dt class="note">'''[[User:CaptainMurphy|CaptainMurphy]]'''</dt><dd class="note">This function does not return a value. Setting "_unit = 'SoldierClass' CreateUnit[_group, _position];" will still result in "_unit" being a null value. You will not be able to do a "_unit RemoveAllWeapons;" because "_unit" will be empty. For any operations to be done to the unit later on you will need to name it and use the name or use the CreateUnit Array. </dd> | |||
<!-- Note Section END --> | <!-- Note Section END --> | ||
</dl> | </dl> |
Revision as of 15:20, 25 May 2009
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. Parameter this is set to the created unit and passed to the code.
- 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
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. - Posted on May 24, 2009 - 00:33
- CaptainMurphy
- This function does not return a value. Setting "_unit = 'SoldierClass' CreateUnit[_group, _position];" will still result in "_unit" being a null value. You will not be able to do a "_unit RemoveAllWeapons;" because "_unit" will be empty. For any operations to be done to the unit later on you will need to name it and use the name or use the CreateUnit Array.
Bottom Section
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint version 1.34
- Operation Flashpoint: New Scripting Commands
- Operation Flashpoint: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands: Global Effect
- Scripting Commands OFP 1.96
- Scripting Commands OFP 1.46
- Scripting Commands ArmA
- Command Group: Object Manipulation