createUnit: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (string != code)
mNo edit summary
Line 1: Line 1:
[[Category:Scripting Commands|CREATEUNIT]]
{{Command|= Comments
[[Category:Scripting Commands OFP 1.96|CREATEUNIT]]
____________________________________________________________________________________________
[[Category:Scripting Commands OFP 1.46|CREATEUNIT]]
[[Category:Scripting Commands ArmA|CREATEUNIT]]


| ofp |= Game name


<h2 style="color:#000066">'''''type'' createUnit ''unitInfo'''''</h2>
|1.34|= Game version


|arg= global |= Arguments in MP


'''Operand types:'''
|eff= global |= Effects in MP
____________________________________________________________________________________________


'''type:''' [[String]]
| Create an interacting AI soldier. |= Description
____________________________________________________________________________________________


'''unitInfo:''' [[Array]]
| type '''createUnit''' [position, group, init*, skill*, rank*] * optional, if one is set, all precedent arguments have to be set too |= Syntax


'''Type of returned value:'''
|p1= type: [[String]] - type of the unit that should be created |= Parameter 1


[[Nothing]]
|p2= position: [[Position]] - position to create the unit at |= Parameter 2


'''Compatibility:'''
|p3= group: [[Group]] - group were the unit will belong to. This group has to exist already! It is not possible to use grpNull as argument. |= Parameter 3


Added in version '''1.34'''
|p4= init: [[String]] - commands that are executed when the unit has been created. The unit is stored in the ''this'' variable. The default value is "". |= Parameter 4


'''Description:'''
|p5= skill: [[Number]] - range 0 to 1. 0 is the lowest skill, 1 the highest. The default value is 0.5. If this argument is set, init must be set too. |= Parameter 5


Create unit of given '''type'''.<br>
|p6= rank: [[String]] - one of "PRIVATE", "CORPORAL", "SERGEANT", "LIEUTNANT", "CAPTAIN", "MAJOR" and "COLONEL". If this argument is set, init and skill must be set too. |= Parameter 6
Format of '''unitInfo''' is:


[pos ([[Position]]), group ([[Group]]),init ([[Code]]), skill ([[Number]]), rank ([[String]])]
| [[Nothing]] |= Return value


'''Note:''' init, skill and rank are optional, default values are:
|mp= 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. |=
____________________________________________________________________________________________
 
|x1= <pre>"SoldierW" createUnit [position player, group player]</pre> |= Example 1
____________________________________________________________________________________________


"", 0.5, "PRIVATE".
| [[createVehicle]], [[deleteVehicle]] |= See also


'''Note:''' The [[Group]] parameter MUST be an existing group or the unit won't be created.
}}


<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->


'''Examples:'''
<!-- Note Section END -->
</dl>


"soldierWB" '''createUnit''' [ [[getMarkerPos]] "barracks", groupAlpha]<br>
<h3 style="display:none">Bottom Section</h3>
"soldierWB" '''createUnit''' [ [[getMarkerPos]] "marker_1", groupAlpha, {loon1 = '''this''' ; '''this''' [[addWeapon]] "binocular"}, 0.6, "corporal"]


 
[[Category:Scripting Commands|CREATEUNIT]]
'''MP Note:'''
[[Category:Scripting Commands OFP 1.96|CREATEUNIT]]
 
[[Category:Scripting Commands OFP 1.46|CREATEUNIT]]
The code in '''init''' is executed on all connected clients in multiplayer.  
[[Category:Scripting Commands ArmA|CREATEUNIT]]
It can therefore be used to get around the [[publicVariable]] limitation of not being able to send strings and arrays over the network.

Revision as of 23:09, 1 August 2006

Hover & click on the images for description

Description

Description:
Create an interacting AI soldier.
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*] * optional, if one is set, all precedent arguments have to be set too
Parameters:
type: String - type of the unit that should be created
position: Position - position to create the unit at
group: Group - group were the unit will belong to. This group has to exist already! It is not possible to use grpNull as argument.
init: String - commands that are executed when the unit has been created. The unit is stored in the this variable. The default value is "".
skill: Number - range 0 to 1. 0 is the lowest skill, 1 the highest. The default value is 0.5. If this argument is set, init must be set too.
rank: String - one of "PRIVATE", "CORPORAL", "SERGEANT", "LIEUTNANT", "CAPTAIN", "MAJOR" and "COLONEL". If this argument is set, init and skill must be set too.
Return Value:
Nothing

Examples

Example 1:
"SoldierW" createUnit [position player, group player]

Additional Information

See also:
createVehicledeleteVehicle

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

Bottom Section