From eeb6ad0903cb44b5f48076422333223af4551fdd Mon Sep 17 00:00:00 2001 From: Zupa Date: Tue, 1 Sep 2015 23:24:15 +0200 Subject: [PATCH] Spawns a non persistence vehicle in the closest open spot. --- @ExileServer/addons/a3_dms/fn_DMS_preInit.sqf | 1 + .../scripts/SpawnNonPersistentVehicle.sqf | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 @ExileServer/addons/a3_dms/scripts/SpawnNonPersistentVehicle.sqf diff --git a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf index c5e1443..da7c571 100644 --- a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf +++ b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf @@ -34,6 +34,7 @@ DMS_CreateMarker = compileFinal preprocessFileLineNumbers "\x\addons\dms\sc DMS_FindSuppressor = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\FindSuppressor.sqf"; DMS_SpawnCrate = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SpawnCrate.sqf"; DMS_SetAILocality = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SetAILocality.sqf"; +DMS_SpawnNonPersistentVehicle = compileFinal preprocessFileLineNumbers "\x\addons\dms\scripts\SpawnNonPersistentVehicle.sqf"; //Load config call compileFinal preprocessFileLineNumbers "\x\addons\dms\config.sqf"; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/scripts/SpawnNonPersistentVehicle.sqf b/@ExileServer/addons/a3_dms/scripts/SpawnNonPersistentVehicle.sqf new file mode 100644 index 0000000..af283bc --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/SpawnNonPersistentVehicle.sqf @@ -0,0 +1,20 @@ +/* + Spawn a non-saved vehicle in Exile + Created by Zupa +*/ + +private ["_vehicleClass","_position","_vehpos","_maxDistance","_vehObj"]; + +_vehicleClass = _this select 0; +_position = _this select 1; +_vehpos = []; +_maxDistance = 40; + +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; +_vehObj