SHARE
TWEET

Untitled

a guest Jul 17th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Proof of concept for new CQB test scoring/////////////////////////////////////////
  2.  
  3. if (isDedicated) exitwith {};//not sure why Sid included this in his range test, but I'm trying it!
  4.  
  5. private ["_locs", "_secs", "_targs", "_civLocs", "_civTargs", "_score", "_door1Pos", "_door2Pos", "_targPos", "_addPos", "_position"];
  6.  
  7. _locs = ["marker_0", "marker_1", "marker_2", "marker_3", "marker_4", "marker_5", "marker_6", "marker_7", "marker_8", "marker_9", "marker_10", "marker_11", "marker_12", "marker_13", "marker_14"];
  8.  
  9. _secs = [["marker_0", "marker_1"],["marker_2", "marker_3", "marker_4"],["marker_5", "marker_6", "marker_7"],["marker_8", "marker_9", "_marker_10"],["marker_11", "marker_12"], ["marker_13", "marker_14"], ["marker_15", "marker_16"]];
  10.  
  11. _targs = [target_0, target_1, target_2, target_3, target_4, target_5, target_6];
  12.  
  13. _civLocs = [["civ_0","civ_1","civ_2"], ["civ_3","civ_4"], ["civ_5","civ_6"]];
  14. _civTargs = [civTarg0,civTarg1,civTarg2];
  15.  
  16. _score = 0;
  17. sFlag = 0;
  18.  
  19. //record initial positions of doors so they can be reset
  20. //_door0Pos = getPos door0; //doing this in the Door0 script instead!!!!!!!!!!!!!
  21. _door1Pos = getPos door1;
  22. _door2Pos = getPos door2;
  23.  
  24. //Record initial positions of all targets so they can be reset after test
  25. _targPos = [];
  26. {
  27.     _addPos = [getPos _x];
  28.     _targPos = _targPos + _addPos;
  29. } forEach _targs;//get starting position of all targets and save as array: _targPos;
  30.  
  31. //Record initial positions of all Civ targets so they can be reset after test
  32. _CivTargPos = [];
  33. {
  34.     _addPosCiv = [getPos _x];
  35.     _CivTargPos = _CivTargPos + _addPosCiv;
  36. } forEach _civTargs;
  37.  
  38.  
  39. //Set up the hostile targets in randomized positions////////////////////
  40.  
  41. //place target for section 0
  42. _position =  ((_secs select 0) call BIS_fnc_selectRandom);
  43. target_0 setPos (getMarkerPos _position);
  44. //target_0 setDir 270;
  45. if (_position == "marker_1") then {target_0 setPos [getMarkerPos "marker_1" select 0, getMarkerPos "marker_1" select 1, (getMarkerPos "marker_1" select 2)+0.6] }; //if target is going to this position, it is on top of crate, so add height to its pos
  46.  
  47. //place targets for section 1
  48. _position =  ((_secs select 1) call BIS_fnc_selectRandom);
  49. target_1 setPos (getMarkerPos _position);
  50. //target_1 setDir 180;
  51. if (_position == "marker_4") then {target_1 setPos [getMarkerPos "marker_4" select 0, getMarkerPos "marker_4" select 1, (getMarkerPos "marker_4" select 2)+1.2] };
  52.  
  53. //place targets for section 2
  54. target_2 setPos (getMarkerPos ((_secs select 2) call BIS_fnc_selectRandom) );
  55.  
  56. //place targets for section 3
  57. target_3 setPos (getMarkerPos ((_secs select 3) call BIS_fnc_selectRandom) );
  58.  
  59. //place targets for section 4
  60. target_4 setPos (getMarkerPos ((_secs select 4) call BIS_fnc_selectRandom) );
  61.  
  62. //place targets for section 5
  63. target_5 setPos (getMarkerPos ((_secs select 5) call BIS_fnc_selectRandom) );
  64.  
  65. //place targets for section 6
  66. target_6 setPos (getMarkerPos ((_secs select 6) call BIS_fnc_selectRandom) );
  67.  
  68.  
  69.  
  70. //Set the Civ targets in randomized positions////////////////////////////
  71. civTarg0 setPos (getMarkerPos ((_civLocs select 0) call BIS_fnc_selectRandom) );
  72. civTarg1 setPos (getMarkerPos ((_civLocs select 1) call BIS_fnc_selectRandom) );
  73. civTarg2 setPos (getMarkerPos ((_civLocs select 2) call BIS_fnc_selectRandom) );
  74.  
  75.  
  76.  
  77. //the action starts here!///////////////////////////////////////////////////////////
  78.  
  79.  
  80. sleep 4; //player has this much time to get first target down
  81. target_0 setPos (getMarkerPos "tempHolding");//this moves the target out of the test so it can't be shot
  82. sleep 3; //this much time to get 2nd target down
  83. target_1 setPos (getMarkerPos "tempHolding");
  84.  
  85. while {sFlag <= 0} do {sleep 1}; //wait for players to open door
  86. door0 setPos Door0pos; //reset door0 to its starting location (location is set in cqbDoor0.sqf)
  87.  
  88. sleep 3;
  89. target_2 setPos (getMarkerPos "tempHolding");
  90. sleep 4;
  91. target_3 setPos (getMarkerPos "tempHolding");
  92.  
  93. while {sFlag <= 1} do {sleep 1};
  94. door1 setPos _door1Pos;//reset the door to its start position
  95.  
  96. sleep 3;
  97. target_4 setPos (getMarkerPos "tempHolding");
  98. target_5 setPos (getMarkerPos "tempHolding");
  99. sleep 3;
  100. target_6 setPos (getMarkerPos "tempHolding");
  101.  
  102.  
  103. //timer started and targets all set; waiting for player to reach the end of the run
  104. waiting = 1;
  105. while {waiting == 1} do {
  106.     sleep 1;
  107. };
  108.  
  109. door2 setPos _door2Pos; //reset the door to its start position
  110.  
  111. //Tally the Score based on targets hit, subtracting points for Civs hit
  112. {if (_x animationPhase "terc" > 0) then {_score = _score + 1;} else {_x animate ["terc", 1];} } forEach _targs;//for each hostile target down, add 1 point
  113. {if (_x animationPhase "terc" > 0) then {_score = _score -2;} else {_x animate ["terc", 1];} } forEach _civTargs;//for each hostile target down, subtract 2 points
  114.  
  115.  
  116.  
  117. //At end of test, clean everything up for another run, if needed.//////////////////////////////////////
  118. for "_i" from 0 to 6 do {
  119.     //hint format ["targ=%1, Pos=%2", _targs select _i, _targPos select _i];//DEBUGGING ONLY!!!!!!!!!!!!!!!!!!
  120.     //sleep 2;//DEBUGGING ONLY!!!!!!!!!!!!!!!!!!
  121.     (_targs select _i) setPos (_targPos select _i);
  122.     (_targs select _i) animate ["terc", 0];
  123. };
  124. for "_i" from 0 to 2 do {
  125.     (_CivTargs select _i) setPos (_CivTargPos select _i);
  126.     (_CivTargs select _i) animate ["terc", 0];
  127. };
  128.  
  129.  
  130. Hint format ["Score =%1", _score];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top