Author: Foxhound
Author Website:

Requirements: No addons required

Version: 1.0

Short description:

Date: 2008-04-27 14:02

Comments: (0)


STM createflyingplane

Those of you who works a lot with createunit/createvehicle to spawn units/vehicles midgame may have noticed that spawning a plane starting midair using:
Object= createVehicle ["ClassType", Position, markers, placement, "special"]
with special set to "FLY" will start planes always heading north. A simple setdir does not work, it changes vehicles orientation but not it's flight direction (funny to watch but useless).
I wrote a little function which extends the createvehicle [array] command with a direction they should start off.

// STM_createflyingplane.sqf
// Created by: -eutf-Myke

_STM_classtype	= _this select 0;
_STM_position	= _this select 1;
_STM_markers	= _this select 2;
_STM_placement	= _this select 3;
_STM_dir	= _this select 4;

_STM_special	= "FLY";

_STM_vehicle 	= createvehicle [_STM_classtype, _STM_position, _STM_markers, _STM_placement, _STM_special];

_STM_vel = (speed _STM_vehicle) / 3.6;
_STM_vehicle setdir _STM_dir;
_STM_vehicle setVelocity [_STM_vel*sin(_STM_dir), _STM_vel*cos(_STM_dir), 0];


It takes basically the same array as the original createvehicle [array] except the "special" parameter. I've hardcoded to "FLY" as this is meant for planes to work. So instead the parameter "special", the parameter direction (in degrees, 0-360) is on fifth position:
STM_createflyingplane	= compile preprocessfilelinenumbers "STM_createflyingplane.sqf";
_STM_new_veh = ["classtype", position, [], placement, direction] call STM_createflyingplane;
As the original createvehicle it will return the vehicle so you can use it almost the same way you did used createvehicle.

As it is based on the original command it takes almost the same parameters and they also work like in the original command, parameters:
- ClassType: String
- Position
- markers: Array
- placement: Number
- direction: Number (0-360)


(download removed by request from the author.

Enable javascript to be able to download from Armaholic please!

Tags: No tags