Advertisement
Guest User

Untitled

a guest
Oct 10th, 2014
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. /*
  2. File: randomize_equipment.sqf
  3. Author: pettka, modified for a different purpose by "ante"
  4.  
  5. Description:
  6.  
  7. Randomizes a headgear form _headgear array and puts it to civilian's headgear slot upon startup of mission.
  8.  
  9. _rnd1 is used to have some civilians without any headgear
  10. _rnd2 is used to determine particular headgear from array
  11.  
  12. Parameter(s):
  13. None
  14.  
  15. Returns:
  16. Nothing
  17. */
  18.  
  19. _uniform = ["FDC_Uniform_Blue","FDC_Uni_Cam_Blue"];
  20. _headgear = ["FDC_Helmet_Blue"];
  21. _vest = ["FDC_Vest_Blue"];
  22.  
  23. _headCount = count _headgear;
  24. _uniformCount = count _uniform;
  25. _vestCount = count _vest;
  26. /*_gogglesCount = count_goggles;*/
  27.  
  28. if (isServer) then {
  29. BIS_randomSeed1 = [];
  30.  
  31. BIS_randomSeed2 = [];
  32.  
  33. _rnd1 = floor random _uniformCount;
  34. _this setVariable ["BIS_randomSeed1", _rnd1, TRUE];
  35.  
  36. _rnd2 = floor random _headCount;
  37. _this setVariable ["BIS_randomSeed2", _rnd2, TRUE];
  38. };
  39.  
  40.  
  41. waitUntil {!(isNil {_this getVariable "BIS_randomSeed1"})};
  42. waitUntil {!(isNil {_this getVariable "BIS_randomSeed2"})};
  43.  
  44. _randomSeed1 = _this getVariable "BIS_randomSeed1";
  45. _randomSeed2 = _this getVariable "BIS_randomSeed2";
  46.  
  47. // Anything magazine based, ammo and such
  48. _magazines = magazines _this;
  49. // Medkits, ToolKits etc.
  50. _items = items _this;
  51. // NVG's, GPS etc.
  52. _assitems = assignedItems _this;
  53.  
  54. // Make him naked
  55. Removeuniform _this;
  56. // Remove helmets and such
  57. Removeheadgear _this;
  58. // Remove glasses and such
  59. RemoveGoggles _this;
  60.  
  61. // Add uniform
  62. _this adduniform (_uniform select _randomSeed1);
  63. // Add helmet
  64. _this addheadgear (_headgear select _randomSeed2);
  65. // Add vest
  66. _this addvest (_vest select (((_randomSeed1 + _randomSeed2) % (_vestCount - 1)) * (floor random _vestCount) % (_vestCount + 1 )));
  67.  
  68. {_this addItem _x} forEach _items;
  69. {_this addMagazine _x} forEach _magazines;
  70. {_this addItem _x} forEach _assitems;
  71. {_this assignItem _x} forEach _assitems;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement