Advertisement
JackoJammie

Arma 3 script "vehicle_respawn.sqf"

May 8th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.73 KB | None | 0 0
  1. /*  [EVO] Dan's vehicle respawn script modified by Steam-User immerfestedruv
  2.     In the Unit Init Field insert <0 = [this,5] execVM "vehicle_respawn.sqf";> for example.
  3.     Will run only on the server, as it only needs to run in one place,
  4.     but obviously can be used in both singleplayer and multiplayer */
  5.  
  6. _veh = _this select 0; // First Argument, get vehicle's details
  7. _delay = _this select 1; // Second Argument, get the init set respawn time
  8. _dirOfVeh = getDir _veh; // get original facing
  9. _posOfVeh = getPosATL _veh; // get original position
  10. _vehtype = typeOf _veh; // get the vehicle type
  11. _vehName = vehicleVarName _veh; // get the Variable-Name from the Vehicle
  12. _n = 1;
  13.  
  14.  
  15. if(isServer) then{
  16.     while{_n == 1} do{
  17.         sleep 12; // sleep for a bit in order to reduce processing calls
  18.         if((!alive _veh) || (!canMove _veh)) then { //true if vehicle is not alive or it cannot move
  19.             deleteVehicle _veh; //clear up old vehicle
  20.             sleep _delay; // delay between deletion and respawn
  21.             _veh = _vehtype createVehicle _posOfVeh; // create a new vehicle of same type at starting position
  22.             _veh setPosATL _posOfVeh; //set correct position
  23.             _veh setDir _dirOfVeh; //set correct facing of the vehicle
  24.             _veh setVehicleVarName _vehName;
  25.            
  26.             /* Next Code-Line will be executed for the new Object by your CPU, but time of execution unkown.
  27.             This behaves similar to the code in the init-field of your object. */
  28.             [[[_veh,_delay],"vehicle_respawn.sqf"],"BIS_fnc_execVM",false,false] spawn BIS_fnc_MP;
  29.             _n = 0; // break out condition
  30.         };
  31.         //hint format ["%2 ist bei %1.",_posOfVeh,_vehName];
  32.     };
  33. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement