darkxess 60 Posted March 2, 2017 Hey guys I am using the script below "fn_vmonitor.sqf" for my vehicle respawn and I want to change the abandoned vehicle to spawn if abandoned back to its original position in time rather than meters. The reason why I am wanting to do such is that the least meters I can get is 10 and that is not enough as our base is a little big and usually things are not being respawned if they are not in their original position due to it being not over 10 meters. So how can I change it to respawn abandoned vehicles in 1 or such, please? Thank you.Script: /* @filename: fn_vMonitor.sqf Credit: Tophe for earlier monitor script Author: Quiksilver Last modified: 23/10/2014 ArmA 1.32 Description: Vehicle monitor. This code must be spawned, not called. Ex. ______________________________________________________*/ if (!isServer) exitWith { /* GO AWAY PLAYER */ }; //======================================== CONFIG private ["_v","_t","_d","_s","_i","_sd","_sp","_ti","_u"]; #define DIST_FROM_SPAWN 150 _v = _this select 0; // vehicle _d = _this select 1; // spawn delay _s = _this select 2; // setup _i = _this select 3; // init _t = typeOf _v; // type _sd = getDir _v; // spawn direction _sp = getPosATL _v; // spawn position sleep (5 + (random 5)); [_v] call _i; //======================================== MONITOR LOOP while {true} do { //======================================== IF DESTROYED if (!alive _v) then { if (({((_sp distance _x) < 1.5)} count (entities "AllVehicles")) < 1) then { _ti = time + _d; waitUntil {sleep 5; (_ti < time)}; if (!isNull _v) then {deleteVehicle _v;}; sleep 0.1; _v = createVehicle [_t,[(random 1000),(random 1000),(10000 + (random 20000))],[],0,"NONE"]; sleep 0.1; waitUntil {!isNull _v}; sleep 0.1; _v setDir _sd; sleep 0.1; _v setPos [(_sp select 0),(_sp select 1),((_sp select 2)+0.1)]; sleep 0.1; [_v] call _i; ["RespawnVehicle",["Vehicle","base",getText (configfile >> "CfgVehicles" >> typeOf _v >> "picture")]] remoteExec ["BIS_fnc_showNotification"]; }; }; sleep (5 + (random 5)); //======================================== IF ABANDONED if ((_v distance _sp) > DIST_FROM_SPAWN) then { if (isMultiplayer) then {_u = playableUnits;} else {_u = switchableUnits;}; if (({(_v distance _x) < PARAMS_VehicleRespawnDistance} count _u) < 1) then { if ((count (crew _v)) == 0) then { _v lock 2; _v allowDamage FALSE; _v setPos [(random 1000),(random 1000),(10000 + (random 20000))]; _v enableSimulationGlobal FALSE; _v hideObjectGlobal TRUE; waitUntil { sleep (5 + (random 5)); (({(_sp distance _x) < 0.10} count (entities "AllVehicles")) < 1) }; _v enableSimulationGlobal TRUE; _v hideObjectGlobal FALSE; _v allowDamage TRUE; _v lock 0; _v setDir _sd; sleep 0.1; _v setPos _sp; sleep 0.1; _v setDamage 0; sleep 0.1; _v setVehicleAmmo 1; sleep 0.1; if ((fuel _v) < 0.95) then {[[_v,1],"setFuel",true,false] spawn BIS_fnc_MP;}; if (isEngineOn _v) then {_v engineOn FALSE;}; sleep 0.1; if (isCollisionLightOn _v) then {_v setCollisionLight FALSE;}; sleep 0.1; if (isLightOn _v) then {_v setPilotLight FALSE;}; sleep 0.1; }; }; }; sleep (20 + (random 20)); }; Share this post Link to post Share on other sites
Nikander 122 Posted March 3, 2017 You might want to have a look at the built-in Arma 3 editor module Vehicle Respawn ? Share this post Link to post Share on other sites
serena 150 Posted March 3, 2017 * it is not working code but only the concept while {true} do { sleep 1; { private _time = _vehicle getVariable "AbandonedAt"; if (VEHICLE_ABANDONED_CONDITION) then { if (isNil "_time") then {_vehicle setVariable ["AbandonedAt", time]} else { if (time - _time > ABANDONED_VHICLE_RESPAWN_DELAY) then { _vehicle setVariable ["AbandonedAt", nil]; // -------------------------- // put your respawn code here // -------------------------- } } } else { if (not isNil "_time") then { _vehicle setVariable ["AbandonedAt", nil]} } } forEach allMyVehicles; }; Share this post Link to post Share on other sites
darkxess 60 Posted March 4, 2017 On 3/3/2017 at 5:30 PM, Nikander said: You might want to have a look at the built-in Arma 3 editor module Vehicle Respawn ? I have mate, but its very buggy, it tends to blow vehicles up on the spawn point even though its set to just delete, respawn at 3 minutes, and nothing else... but it bugs out sometimes.@serena - it has been tested? this is for a live server so :) Share this post Link to post Share on other sites