Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Proof of concept for new CQB test scoring/////////////////////////////////////////
- if (isDedicated) exitwith {};//not sure why Sid included this in his range test, but I'm trying it!
- private ["_locs", "_secs", "_targs", "_civLocs", "_civTargs", "_score", "_door1Pos", "_door2Pos", "_targPos", "_addPos", "_position"];
- _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"];
- _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"]];
- _targs = [target_0, target_1, target_2, target_3, target_4, target_5, target_6];
- _civLocs = [["civ_0","civ_1","civ_2"], ["civ_3","civ_4"], ["civ_5","civ_6"]];
- _civTargs = [civTarg0,civTarg1,civTarg2];
- _score = 0;
- sFlag = 0;
- //record initial positions of doors so they can be reset
- //_door0Pos = getPos door0; //doing this in the Door0 script instead!!!!!!!!!!!!!
- _door1Pos = getPos door1;
- _door2Pos = getPos door2;
- //Record initial positions of all targets so they can be reset after test
- _targPos = [];
- {
- _addPos = [getPos _x];
- _targPos = _targPos + _addPos;
- } forEach _targs;//get starting position of all targets and save as array: _targPos;
- //Record initial positions of all Civ targets so they can be reset after test
- _CivTargPos = [];
- {
- _addPosCiv = [getPos _x];
- _CivTargPos = _CivTargPos + _addPosCiv;
- } forEach _civTargs;
- //Set up the hostile targets in randomized positions////////////////////
- //place target for section 0
- _position = ((_secs select 0) call BIS_fnc_selectRandom);
- target_0 setPos (getMarkerPos _position);
- //target_0 setDir 270;
- 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
- //place targets for section 1
- _position = ((_secs select 1) call BIS_fnc_selectRandom);
- target_1 setPos (getMarkerPos _position);
- //target_1 setDir 180;
- 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] };
- //place targets for section 2
- target_2 setPos (getMarkerPos ((_secs select 2) call BIS_fnc_selectRandom) );
- //place targets for section 3
- target_3 setPos (getMarkerPos ((_secs select 3) call BIS_fnc_selectRandom) );
- //place targets for section 4
- target_4 setPos (getMarkerPos ((_secs select 4) call BIS_fnc_selectRandom) );
- //place targets for section 5
- target_5 setPos (getMarkerPos ((_secs select 5) call BIS_fnc_selectRandom) );
- //place targets for section 6
- target_6 setPos (getMarkerPos ((_secs select 6) call BIS_fnc_selectRandom) );
- //Set the Civ targets in randomized positions////////////////////////////
- civTarg0 setPos (getMarkerPos ((_civLocs select 0) call BIS_fnc_selectRandom) );
- civTarg1 setPos (getMarkerPos ((_civLocs select 1) call BIS_fnc_selectRandom) );
- civTarg2 setPos (getMarkerPos ((_civLocs select 2) call BIS_fnc_selectRandom) );
- //the action starts here!///////////////////////////////////////////////////////////
- sleep 4; //player has this much time to get first target down
- target_0 setPos (getMarkerPos "tempHolding");//this moves the target out of the test so it can't be shot
- sleep 3; //this much time to get 2nd target down
- target_1 setPos (getMarkerPos "tempHolding");
- while {sFlag <= 0} do {sleep 1}; //wait for players to open door
- door0 setPos Door0pos; //reset door0 to its starting location (location is set in cqbDoor0.sqf)
- sleep 3;
- target_2 setPos (getMarkerPos "tempHolding");
- sleep 4;
- target_3 setPos (getMarkerPos "tempHolding");
- while {sFlag <= 1} do {sleep 1};
- door1 setPos _door1Pos;//reset the door to its start position
- sleep 3;
- target_4 setPos (getMarkerPos "tempHolding");
- target_5 setPos (getMarkerPos "tempHolding");
- sleep 3;
- target_6 setPos (getMarkerPos "tempHolding");
- //timer started and targets all set; waiting for player to reach the end of the run
- waiting = 1;
- while {waiting == 1} do {
- sleep 1;
- };
- door2 setPos _door2Pos; //reset the door to its start position
- //Tally the Score based on targets hit, subtracting points for Civs hit
- {if (_x animationPhase "terc" > 0) then {_score = _score + 1;} else {_x animate ["terc", 1];} } forEach _targs;//for each hostile target down, add 1 point
- {if (_x animationPhase "terc" > 0) then {_score = _score -2;} else {_x animate ["terc", 1];} } forEach _civTargs;//for each hostile target down, subtract 2 points
- //At end of test, clean everything up for another run, if needed.//////////////////////////////////////
- for "_i" from 0 to 6 do {
- //hint format ["targ=%1, Pos=%2", _targs select _i, _targPos select _i];//DEBUGGING ONLY!!!!!!!!!!!!!!!!!!
- //sleep 2;//DEBUGGING ONLY!!!!!!!!!!!!!!!!!!
- (_targs select _i) setPos (_targPos select _i);
- (_targs select _i) animate ["terc", 0];
- };
- for "_i" from 0 to 2 do {
- (_CivTargs select _i) setPos (_CivTargPos select _i);
- (_CivTargs select _i) animate ["terc", 0];
- };
- Hint format ["Score =%1", _score];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement