Advertisement
Guest User

Untitled

a guest
May 2nd, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. _markers = Markers;
  2. _squad = group (_this select 0);
  3. _names = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p"];
  4. //again this script will fire once for the squad
  5. num1 = (round(random (count _names))) - 1;
  6. num2 = ceil(random 99);
  7.  
  8. _varCreate = [] call compile format["%1%2 = 0;%1%2 = _numVar;",num1,num2];
  9.  
  10.  
  11. varAlgo =
  12. {
  13. _killed = _this select 0;
  14. _killer = _this select 1;
  15. _killers = units (group _killer);
  16. _types = [ ];
  17. _processed = [ ];
  18.  
  19. _tempNum1 = _killed getvariable "support";
  20.  
  21. if (_tempNum1 == 1) then {
  22. { _x setvariable ["support",0];
  23. }
  24. foreach units (group _killed);
  25.  
  26. {
  27.  
  28. if (!((vehicle _x) in _processed)) then {
  29. _processed = _processed + [(vehicle _x)];
  30. _tempNum2 = 1;
  31. _passedIn = 0;
  32. _tempVeh = _x;
  33.  
  34. {
  35. if ((typeof _tempVeh)==(_x select 0)) then
  36. {
  37. _passedIn = 1;
  38. };
  39. }
  40. forEach _types;
  41.  
  42. if (_passedIn==0) then {
  43. _types = _types + [[(typeof _veh),1]];
  44. } else {
  45. { if ((_x select 0)==(typeof _tempVeh) then {
  46. _x set [1,(_x select 1) + 1];
  47. };
  48. }
  49. foreach _types;
  50. };
  51.  
  52. };
  53.  
  54. } foreach _killers;
  55. //killers (friendly) array created
  56.  
  57. //block for closest marker select
  58. _closest = (getmarkerpos (supMarkers select 0)) distance (getpos _killed);
  59. _closestMarker = 0;
  60. {
  61. if (((getpos _killed) distance (getMarkerPos _x))< _closest) then {
  62. _closestMarker = _forEachIndex;
  63. };
  64. }
  65. forEach supMarkers;
  66.  
  67. //spawn support units
  68.  
  69. //set general amounts for each type
  70. _supportType = [["Man",0],["Car",0],["Tank",0],["Helicopter",0],["Plane",0]];
  71.  
  72. {
  73. _tempVeh = _x;
  74.  
  75. {
  76. if ((_x select 0) isKindOf (_tempVeh select 0)) then {
  77. while {(_x select 1)>0} do {
  78. _tempVeh set [1,(_tempVeh select 1) + 1];
  79. _x set [1,(_x select 1) - 1];
  80. };
  81. };
  82. } foreach _types;
  83.  
  84. _fixAmount = ceil(((_x select 1)^2)/2 + (_x select 1));
  85. _x set [1,_fixAmount];
  86.  
  87. }
  88. foreach _supportType;
  89.  
  90. //set counter unit by random chance. for example, a tank thread might have an AT squad spawned or another tank.
  91.  
  92. };
  93.  
  94. {
  95. _x setVariable ["supportCall",1];
  96. }
  97. foreach units (group _squad);
  98.  
  99. };
  100.  
  101.  
  102. {
  103. _eHNum = _x addEventHandler
  104. [
  105. "killed",
  106. {
  107. _varExec = [] call compile format["%1%2 = 1; publicvariable '%1%2';",num1,num2];
  108.  
  109. _varCall = _this call varSpawn;
  110.  
  111. {
  112. _x removeEventHandler ["killed",_eHNum];
  113. }
  114. foreach units (group _x);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement