DMS_Exile/@ExileServer/addons/a3_dms/scripts/SpawnNonPersistentVehicle.sqf
eraser1 3760bc9826 Tweaks to Zupa's "SpawnNonPersistentVehicle" and comments
Used function "params" to parse input.

Decrease the initial "maxDistance"

Added debug log for the function

Improved explanation of a couple of configs
2015-09-01 19:43:17 -05:00

51 lines
1.1 KiB
Plaintext

/*
DMS_SpawnNonPersistentVehicle
Spawn a non-saved vehicle in Exile
Created by Zupa
Edited by eraser1
Usage:
[
_vehicleClass, // STRING: Classname of the vehicle
_pos // ARRAY: Position to spawn it at (roughly)
] call DMS_SpawnNonPersistentVehicle;
Returns the vehicle object of the created vehicle.
*/
private ["_vehicleClass","_position","_vehpos","_maxDistance","_vehObj"];
_OK = params
[
["_vehicleClass","",[""]],
["_position","",[[]],[2,3]]
];
if (!_OK) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_SpawnNonPersistentVehicle with invalid parameters: %1",_this];
};
_vehpos = [];
_maxDistance = 10;
while{count _vehpos < 1} do
{
_vehpos = _position findEmptyPosition [20,_maxDistance,_vehicleClass];
_maxDistance = (_maxDistance + 15);
};
_vehObj = ObjNull;
_vehObj = [_vehicleClass, _vehpos, (random 360), true] call ExileServer_object_vehicle_createNonPersistentVehicle;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG SpawnNonPersistentVehicle :: Created %1 at %2 with calling parameters: %3",_vehObj,_vehpos,_this];
};
_vehObj