createVehicleLocal: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "(Optional, default {{hl|[]}})" to "(Optional, default <sqf inline>[]</sqf>)") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 20: | Line 20: | ||
|gr1= Object Manipulation | |gr1= Object Manipulation | ||
|descr= Creates an object of the given type. Created object is not transferred through network in MP games. | |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. | [[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. | Alternatively, you can use [[createSimpleObject]] with local option enabled where applicable. | ||
Line 26: | Line 26: | ||
|s1= type [[createVehicleLocal]] position | |s1= type [[createVehicleLocal]] position | ||
|p1= type: [[String]] | |p1= type: [[String]] - vehicle/object className | ||
|p2= position: [[Array]] format [[Position#PositionAGL|PositionAGL]] | |p2= position: [[Array]] format [[Position#PositionAGL|PositionAGL]] | ||
Line 38: | Line 38: | ||
|p21= type: [[String]] - vehicle/object className | |p21= type: [[String]] - vehicle/object className | ||
|p22= position: [[Object]] | |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. | |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. | |p24= placement: [[Number]] - (Optional, default 0) the vehicle is placed inside a circle with given position as center and placement as its radius. | ||
Line 57: | Line 58: | ||
|x3= <sqf> | |x3= <sqf> | ||
// | // since {{arma3}} v2.14 | ||
private _lightPoint = createVehicleLocal ["#lightpoint", getMarkerPos "marker1", ["marker2", "marker3"], 0, "NONE"]; | private _lightPoint = createVehicleLocal ["#lightpoint", getMarkerPos "marker1", ["marker2", "marker3"], 0, "NONE"]; | ||
</sqf> | </sqf> | ||
Line 79: | Line 80: | ||
|user= demellion | |user= demellion | ||
|timestamp= 20181102121600 | |timestamp= 20181102121600 | ||
|text= '''WARNING:''' Do not instigate [[createVehicle]] or [[createVehicleLocal]] within a server function executed with [[Arma 3: Functions Library# | |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. | 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. | ||
}} | }} |
Revision as of 18:09, 18 November 2023
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.
- Return Value:
- Object - created vehicle or objNull if failed
Examples
- Example 1:
- Example 2:
- 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
- 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).
- 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).
- 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.
Categories:
- Scripting Commands
- Introduced with Armed Assault version 1.00
- ArmA: Armed Assault: New Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Object Manipulation
- Scripting Commands: Local Effect