Jump to content
Sign in to follow this  
logan83

Counting Downed Popups Targets

Recommended Posts

Hi Dudes! im Working in a training mision to my Campaign, and have some Firing Ranges With Random Targets etc... But I want to make a Range with Raised targets, and when i shoot to them make a downed targets count, like in a Raid or a COF. Some Body Know how can i make it? i try this but doesnt work :(

popup=FALSE;
_count = 0;
_targets  = [CQB_1, CQB_2, CQB_3, CQB_4, CQB_5, CQB_6, CQB_7, CQB_8, CQB_9, CQB_10, CQB_11, CQB_12, CQB_13, CQB_14, CQB_15, CQB_16, CQB_17, CQB_18, CQB_19, CQB_20, CQB_21, CQB_22, CQB_23, CQB_24, CQB_25, CQB_26, CQB_27];
nopop=true;
{_x  animate["terc",0]} forEach _targets;
hint "GoGoGo";
sleep 5;

while {_count<26} do {
sleep 2;
 if (_targets animationPhase "terc" > 0.1) then {
		_count = _count+1;
		    };

   hint format ["Hit :%2",_count];

};
sleep 4;

Share this post


Link to post
Share on other sites

The reason it doesn't work is because _targets is an array (all the targets) and animationphase only works with single items.

 

You're going to need another method of counting downed targets.

 

something like this may be a start

 

 

save it with the same name your calling the current script

popup=FALSE;
counter = 0;
_targets  = [CQB_1, CQB_2, CQB_3, CQB_4, CQB_5, CQB_6, CQB_7, CQB_8, CQB_9, CQB_10, CQB_11, CQB_12, CQB_13, CQB_14, CQB_15, CQB_16,
 CQB_17, CQB_18, CQB_19, CQB_20, CQB_21, CQB_22, CQB_23, CQB_24, CQB_25, CQB_26, CQB_27];
nopop=true;

{
_x addeventHandler ["Hit",{(_this select 0) execvm "counter.sqf"}];
} forEach _targets;

sleep 0.2;

Player sidechat "GoGoGo";

hint format ["Hit :%1",counter];
_duration = 20;
While {_duration > 0} do {
     Player sidechat str _duration;    
    sleep 1;
    _duration = _duration -1;
     };
     
Player sidechat str _duration;    

{
_x removeallEventHandlers "hit";
} forEach _targets;

Player sidechat "Session Over";

You will also need a second script to do the counting

 

 

save as "counter.sqf"

sleep 0.1;
 if (_this animationPhase "terc" > 0.01) then {
        counter = counter+1;
        _this removeallEventHandlers "hit";
            };

   hint format ["Hit :%1",counter];

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×