createVehicleLocal: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "Category:Scripting Commands ArmA2" to "Category:Scripting Commands Arma 2")
(Add more (all?) #types that can be created)
 
(53 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma |Game name=
|game1= arma1
|version1= 1.00


|1.00|Game version=
|game2= arma2
|eff= local |Multiplayer Effects=
|version2= 1.00
____________________________________________________________________________________________


| Creates an object of the given type. Created object is not transferred through network in MP games. [[netId]] of such vehicle in multiplayer will be "0:0". To disable local vehicle creation, use [[CfgDisabledCommands]] to blacklist this command. Alternatively, you can use [[createSimpleObject]] with local option enabled where applicable.|DESCRIPTION=
|game3= arma2oa
____________________________________________________________________________________________
|version3= 1.50


| type '''createVehicleLocal''' position |SYNTAX=
|game4= tkoh
|version4= 1.00


|p1= type: [[String]] |PARAMETER1=
|game5= arma3
|version5= 0.50


|p2= position: [[Position]] |PARAMETER2=
|eff= local


| [[Object]] |RETURNVALUE=
|gr1= Object Manipulation
____________________________________________________________________________________________
 
|x1= <code>_lightsource = "#lightpoint" [[createVehicleLocal]] _pos;</code> |EXAMPLE1=
____________________________________________________________________________________________


| [[createVehicle]], [[createMine]], [[deleteVehicle]], [[createUnit]]|SEEALSO=
|descr= Creates an object of the given type. The Created object is not transferred through network in MP games.
[[netId]] of such vehicle in multiplayer will be "0:0". To disable local vehicle creation, use [[CfgDisabledCommands]] to blacklist this command.
Alternatively, you can use [[createSimpleObject]] with local option enabled where applicable.


}}
|s1= type [[createVehicleLocal]] position
 
|p1= type: [[String]] - vehicle/object className
 
|p2= position: [[Array]] format [[Position#PositionAGL|PositionAGL]]
 
|r1= [[Object]]
 
|s2= [[createVehicleLocal]] [type, position, markers, placement, special]
 
|s2since= arma3 2.14
 
|p21= type: [[String]] - vehicle/object className
 
|p22= position: [[Object]], [[Array]] format [[Position#Introduction|Position2D]] or [[PositionATL]] ([[PositionAGL]] if watercraft or amphibious) - desired placement position
 
|p23= markers: [[Array]] of [[String]]s - (Optional, default <sqf inline>[]</sqf>) if the markers array contains any markers, the position is randomly picked from array of given markers plus desired placement position.
If any of the markers were given z coordinate with [[setMarkerPos]], the vehicle will also be created at given z coordinate.
 
|p24= placement: [[Number]] - (Optional, default 0) the vehicle is placed inside a circle with given position as center and placement as its radius.
 
|p25= special: [[String]] - (Optional, default "NONE") can be one of the following:
* {{hl|"NONE"}} - will look for suitable empty position near given position (subject to other placement params) before placing vehicle there.
* {{hl|"CAN_COLLIDE"}} - places vehicle at given position (subject to other placement params), without checking if others objects can cross its 3D model.
* {{hl|"FLY"}} - if vehicle is capable of flying and has crew, it will be made airborne at default height.
If ''special'' is "" or not specified, default {{hl|"NONE"}} is used.


<h3 style="display:none">Notes</h3>
|r2= [[Object]] - created vehicle or [[objNull]] if failed
<dl class="command_description">
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on 07:18, 5 June 2008 (CEST)</dd>
<dt class="note">[[User:Kronzky|Kronzky]]</dt><dd class="note">
If the object that is created is of the type ammo, then it will created on '''all''' clients (''tested only on VBS2'').


<dd class="notedate">Posted on 18:04, 5 September 2013 (CEST)</dd>
|x1= <sqf>_lightSource = "#lightpoint" createVehicleLocal _pos;</sqf>
<dt class="note">[[User:DamonDaemon|DamonDaemon]]</dt><dd class="note">
Indeed the type of Ammo is transfered to '''ALL''' clients, but apparently also the muzzle effects (firing sound, light, etc.); this includes muzzles from Horns (Truck or Car Horn, Bicycle bells, etc.) as well as any other weapon. Tested on Arma 1 - Arma 2 OA (latest patch).
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>
|x2= Multiple types:
<sqf>
private _lightSource = "#lightsource" createVehicleLocal _pos; // see [[Light Source Tutorial]]
private _lightReflector = "#lightreflector" createVehicleLocal _pos; // see [[Light Source Tutorial]] - since {{arma3}} v2.06
private _particleSource = "#particlesource" createVehicleLocal _pos; // see [[Particles Tutorial]]
private _dynamicSound = "#dynamicsound" createVehicleLocal _pos; // see [[createSoundSource]]
</sqf>


[[Category:Scripting Commands|CREATEVEHICLELOCAL]]
|x3= <sqf>
[[Category:Scripting Commands OFP Elite |CREATEVEHICLELOCAL]]
// since {{arma3}} v2.14
[[Category:Scripting Commands ArmA|CREATEVEHICLELOCAL]]
private _lightPoint = createVehicleLocal ["#lightpoint", getMarkerPos "marker1", ["marker2", "marker3"], 0, "NONE"];
[[Category:Command_Group:_Object_Manipulation|CREATEVEHICLELOCAL]]
</sqf>
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
|seealso= [[createVehicle]] [[createMine]] [[deleteVehicle]] [[createUnit]]
<dl class="command_description">
}}
<dd class="notedate">Posted on November 2, 2018 - 12:16 (UTC)</dd>
 
<dt class="note">[[User:demellion|demellion]]</dt>
{{Note
<dd class="note">
|user= Kronzky
'''WARNING:''' Do not instigate [[createVehicle]] or [[createVehicleLocal]] within a server function executed with [[Functions_Library_(Arma_3)#Pre_and_Post_Init|preInit]] flag.<br> This will cause ''"You cannot play/edit this mission"'' for a vehicles compiled from a [[Arma_3_Startup_Parameters|-mod]] and make server skip/loop that mission init.
|timestamp= 20080605071800
</dd>
|text= If the object that is created is of the type ammo, then it will created on '''all''' clients (''tested only on VBS2'').
</dl>
}}
<!-- DISCONTINUE Notes -->
 
{{Note
|user= DamonDaemon
|timestamp= 20130905180400
|text= Indeed the type of Ammo is transfered to '''ALL''' clients, but apparently also the muzzle effects (firing sound, light, etc.); this includes muzzles from Horns (Truck or Car Horn, Bicycle bells, etc.) as well as any other weapon. Tested on {{Name|arma1|short}} - {{Name|arma2oa|short}} (latest patch).
}}
 
{{Note
|user= demellion
|timestamp= 20181102121600
|text= '''WARNING:''' Do not instigate [[createVehicle]] or [[createVehicleLocal]] within a server function executed with [[Arma 3: Functions Library#Pre and Post Init|preInit]] flag.<br>
This will cause ''"You cannot play/edit this mission"'' for a vehicles compiled from a [[Arma 3: Startup Parameters#Modifications|-mod]] and make server skip/loop that mission init.
}}

Latest revision as of 01:06, 4 March 2024

Hover & click on the images for description

Description

Description:
Creates an object of the given type. The Created object is not transferred through network in MP games. netId of such vehicle in multiplayer will be "0:0". To disable local vehicle creation, use CfgDisabledCommands to blacklist this command. Alternatively, you can use createSimpleObject with local option enabled where applicable.
Groups:
Object Manipulation

Syntax

Syntax:
type createVehicleLocal position
Parameters:
type: String - vehicle/object className
position: Array format PositionAGL
Return Value:
Object

Alternative Syntax

Syntax:
createVehicleLocal [type, position, markers, placement, special]
Parameters:
type: String - vehicle/object className
position: Object, Array format Position2D or PositionATL (PositionAGL if watercraft or amphibious) - desired placement position
markers: Array of Strings - (Optional, default []) if the markers array contains any markers, the position is randomly picked from array of given markers plus desired placement position. If any of the markers were given z coordinate with setMarkerPos, the vehicle will also be created at given z coordinate.
placement: Number - (Optional, default 0) the vehicle is placed inside a circle with given position as center and placement as its radius.
special: String - (Optional, default "NONE") can be one of the following:
  • "NONE" - will look for suitable empty position near given position (subject to other placement params) before placing vehicle there.
  • "CAN_COLLIDE" - places vehicle at given position (subject to other placement params), without checking if others objects can cross its 3D model.
  • "FLY" - if vehicle is capable of flying and has crew, it will be made airborne at default height.
If special is "" or not specified, default "NONE" is used.
Return Value:
Object - created vehicle or objNull if failed

Examples

Example 1:
_lightSource = "#lightpoint" createVehicleLocal _pos;
Example 2:
Multiple types:
private _lightSource = "#lightsource" createVehicleLocal _pos; // see Light Source Tutorial private _lightReflector = "#lightreflector" createVehicleLocal _pos; // see Light Source Tutorial - since Arma 3 v2.06 private _particleSource = "#particlesource" createVehicleLocal _pos; // see Particles Tutorial private _dynamicSound = "#dynamicsound" createVehicleLocal _pos; // see createSoundSource
Example 3:
// since Arma 3 v2.14 private _lightPoint = createVehicleLocal ["#lightpoint", getMarkerPos "marker1", ["marker2", "marker3"], 0, "NONE"];

Additional Information

See also:
createVehicle createMine deleteVehicle createUnit

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
Kronzky - c
Posted on Jun 05, 2008 - 07:18 (UTC)
If the object that is created is of the type ammo, then it will created on all clients (tested only on VBS2).
DamonDaemon - c
Posted on Sep 05, 2013 - 18:04 (UTC)
Indeed the type of Ammo is transfered to ALL clients, but apparently also the muzzle effects (firing sound, light, etc.); this includes muzzles from Horns (Truck or Car Horn, Bicycle bells, etc.) as well as any other weapon. Tested on ArmA - Arma 2:OA (latest patch).
demellion - c
Posted on Nov 02, 2018 - 12:16 (UTC)
WARNING: Do not instigate createVehicle or createVehicleLocal within a server function executed with preInit flag.
This will cause "You cannot play/edit this mission" for a vehicles compiled from a -mod and make server skip/loop that mission init.