Page tree
Skip to end of metadata
Go to start of metadata


Introduced in

Version:1.00

Description

Description:Creates an empty vehicle / object of a given type at a given position.

The vehicle is placed at the nearest possible position to the one specified, to prevent colliding with existing objects. Even if there are no other objects in the way, the created position may not be completely accurate, and would have to be reset, using setPos, if accuracy is crucial.

To create units, use createUnit. To create mines, use createMine.

Syntax

Syntax:type createVehicle position
Parameters:
Return Value:Object

Alternative Syntax

Syntax:createVehicle [type, position, markers, placement, special, local, asl, noClip, symbol, forcePos, doNotRecord]
Parameters:
  • type: String - Type of object to be created.
  • position: Position - Data Type - Initial position as PositionAGL, or, if asl is set to true, as PositionASL.
  • markers: Array - If the array contains several marker names, the position of a random one is used to place the vehicle. Otherwise, the given position is used.
  • placement: Number - Radius of a circle to randomly place the vehicle in.
  • special: String - Can be:
    • "NONE" - Vehicle is created on the ground.
    • "FLY" - Vehicle is created in the air (specified by flyInHeight in the class configuration).
    • "CAN_COLLIDE" - If the object is created close to an existing one, the initial position is not corrected. If used with the asl parameter, then the object can be created above the ground.
  • local: Boolean - If true, then object is created only on the local computer (optional, default: false).
  • asl: Boolean - If true, then position is interpreted as ASL. Requires the special parameter to be set to "CAN_COLLIDE" (optional, default: false - creates an object on the ground, regardless of the position z-value).
  • noClip: Boolean - If asl is set to true, then setting noClip to true always creates the object above the ground. PhysX vehicles are always created above the ground, regardless of the noClip setting (optional, default: false).
  • symbol: String - Path to texture to use for briefing display of object. Use "SYMBOL" to draw visitor style map symbol (only works for objects created during briefing, using the "BRIEFING" argument of the editor object) (optional, default: "").
  • forcePos: Boolean - If true, the object is placed exactly at the specified position, even if it ends up colliding with another object (optional, default: false) (V1.64+).
  • doNotRecord: Boolean - If true, the object is not recorded in the AAR. If false, the object is recorded in the AAR (optional, default: false) (V17.4.0+).
Return Value:Object

Examples

Examples:
_jeep = "LandRover" createVehicle (position player)
_heli = "AH1W" createVehicle (getMarkerPos "hspawn")
_veh = createVehicle ["A10", position player, [], 0, "FLY"]
_veh = createVehicle ["A10", position player, [], 0, "FLY", true, true, false, "", false, true] // object is not recorded in the AAR
_veh = createVehicle ["A10", position player, [], 0, "FLY", true, true, false, "", false, false] // object is recorded in the AAR

Additional Information

See also: createVehicleLocal, createUnit, createMine, deleteVehicle, fn vbs createVehicle
Multiplayer:
Problems:

Notes







Posted on February 22, 2012 - 11:48
Kronzky
Planes started in the air will have an initial speed that seems to be the average between their maxspeed and landingSpeed, and will be pointed north.

If the plane is initially set to a different direction, it will lose all its momentum, and most likely crash to the ground. To circumvent this, it has to be given an initial setVelocity in the appropriate direction:

_plane = createVehicle ["A10", getPos player,[],0,"FLY"];
_pilot = (group player) createUnit [typeOf player, getPos player, [], 0, "NONE"];
_pilot moveInDriver _plane;
_dir = 90;
_plane setDir _dir;
_speed = (getNumber (configFile>>"cfgvehicles">>"a10">>"maxspeed") + getNumber (configFile>>"cfgvehicles">>"a10">>"landingSpeed")) / 2;
_plane setVelocity [sin _dir*(_speed/3.6), cos _dir*(_speed/3.6), 0];


Posted on December 13, 2006 - 12:27
Salisan
Observe that buildings with the default destrType will not work correctly in multiplayer, when created with this command. The Destruction effect will only be displayed where the building is local.