Advertisement
TomMack

saveAmmobox.sqf

Jun 12th, 2017
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.50 KB | None | 0 0
  1. /*
  2.     File:       saveVehicles.sqf
  3.     Author:     xBowBii (aka xbwb)
  4.    
  5.     Modified by Tom Mack - 13/06/17
  6.     ammo box classnames:: https://community.bistudio.com/wiki/Arma_3_CfgVehicles_Equipment
  7.     (ctrl+F "ammo".)
  8.    
  9. */
  10. SURV_VehiclesLoaded = false;
  11.  
  12.     profileNamespace setVariable ["SURV_Vehicles",[]];
  13.  
  14.     {
  15.    
  16.         _Vehs  = profileNamespace getVariable ["SURV_Vehicles",[]];
  17.         _vehicle = _x;
  18.  
  19.         _xType = typeOf _x;
  20.         _xPos  = getPos _x;
  21.         _xDir  = getDir _x;
  22.         _xDmg  = damage _x;
  23.         _xOwns = _x getVariable ["myCVar",[]];
  24.         _xFuel = fuel _x;
  25.         _weapons = weaponCargo _x;
  26.         _magazines = magazineCargo _x;
  27.  
  28.         _hitPoints = [];
  29.         _cachekey = format["%1_HP", _xType];
  30.         _hitpoints = missionNamespace getVariable[_cachekey, []];
  31.        
  32.         _items = itemCargo _x; //added to copy "items" types
  33.        
  34.         if (_hitpoints isEqualTo []) then
  35.         {
  36.             _na = configProperties[configFile >> "CfgVehicles" >> _xType >> "HitPoints", "_hitpoints pushBack configName _x; true", true];
  37.             missionNamespace setVariable[_cachekey, _hitpoints];
  38.         };
  39.  
  40.         _finalHitPs = [];
  41.         {
  42.             _finalHitPs = _finalHitPs + [[_x,_vehicle getHitPointDamage _x]];
  43.         } forEach _hitPoints;
  44.  
  45.         profileNamespace setVariable ["SURV_Vehicles",(_vehs + [[_xtype,_xpos,_xdir,_xdmg,_xowns,_xFuel,_weapons,_magazines,_finalHitPs,_items]])];
  46.  
  47.     } ForEach (nearestObjects [getmarkerpos "mymarker",["Box_IND_AmmoOrd_F", "Box_IND_Wps_F", "Box_NATO_Wps_F", "Box_NATO_WpsSpecial_F", "Box_NATO_Ammo_F"],100]); //add ammo box classnames to this array.
  48.    
  49.    
  50.     saveProfileNamespace;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement