Jump to content
I.Reyes

Firing Range (hints)

Recommended Posts

Hello everyone,

 

  So I pulled an old script I was using for a firing range in Arma2. It works great in Arma3. I would like to add a feature to it, but I'm not sure how to go about it this. The script currently tracks both the targets and the hits. Before it shows session complete, I would like for it to auto determine the shooters qualification. For example, If a shooter hits 23 out of 40 it should say, "Qualified Marksman" prior to ending the session. The script I'm using can be found below. Thank you in advance for all of your help.

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

_inc     = 0;
_count   = 0;
_targets = [l11, l12, l13, l14, l15, l16, l17, l18];
_many    =  count _targets;
nopop=true;
{_x  animate["terc",1]} forEach _targets;

hint "Setting up the Range";
sleep 9;
hint "Range Ready";
sleep 2;
hint "Switch Your Weapon From Safety to Semi";
sleep 2;
hint "Commence Fire";
sleep 2;

while {_inc<40} do 
{
_rnumber = random _many-.25;
_rtarget = _targets select _rnumber;
_rtarget animate["terc", 0];
sleep 3;
if (_rtarget animationPhase "terc" > 0.001) then
{
    _count = _count+1;
        };
  hintSilent format ["Targets :%1 Hit :%2",_inc+1,_count];
_rtarget animate["terc", 1];
_inc = _inc + 1;
};
    
sleep 8;
hint "Session Complete";

Share this post


Link to post
Share on other sites

If I am reading this script correctly should just be an easy series of if statements?

Right before the final two lines, something like this?

 

if(_count <= 23) then {

          hint "You are a qualified marksman";

};

Share this post


Link to post
Share on other sites
16 hours ago, Gen. MERICA said:

If I am reading this script correctly should just be an easy series of if statements?

Right before the final two lines, something like this?

 

if(_count <= 23) then {

          hint "You are a qualified marksman";

};

Oustanding! Exactly what I was looking for.

Share this post


Link to post
Share on other sites

I'm going to push my luck and see if anyone can assist with two more things. One is an actual problem, the other would just be a nice added feature.

 

PROBLEM

The code works perfectly fine for a single lane. I assumed I could localize the hints and just copy the sqf with different lane numbers. Although this those work to the extent that each player sees their respective lane info, once two or more lanes are firing at the same time, it's like each sqf is fighting for control over the other. Multiple targets start popping up in each lane and it becomes a mess. I'll post the updated codes below. The only difference between the two files are the targets they control (identified it in red).

 

FEATURE

I would like to be able to display the final hit count for each lane on a board. I don't know that is possible.

 

CODE

//LANE 1 IS EXECUTED BY          nul=[] execVM "lanes\lane1.sqf";

_inc     = 0;
_count   = 0;
_targets = [l11, l12, l13, l14, l15, l16, l17, l18];
_many    =  count _targets;
nopop=true;
{_x  animate["terc",1]} forEach _targets;

hint "Setting up the Range";
sleep 9;
hint "Range Ready";
sleep 2;
hint "Switch Your Weapon From Safety to Semi";
sleep 2;
hint "Commence Fire";
sleep 2;

while {_inc<30} do 
{
_rnumber = random _many-.25;
_rtarget = _targets select _rnumber;
_rtarget animate["terc", 0];
sleep 3;
if (_rtarget animationPhase "terc" > 0.001) then
{
    _count = _count+1;
        };
  hintSilent format ["Targets :%1 Hit :%2",_inc+1,_count];
_rtarget animate["terc", 1];
_inc = _inc + 1;
};
if(_count <= 18) then {

          hint "SEE THE RSO";

};
if(_count >= 18) then {

          hint "Qualified MARKSMAN";

};
if(_count >= 22) then {

          hint "Qualified SHARPSHOOTER";

};
if(_count >= 27) then {

          hint "Qualified EXPERT";

};
sleep 5;
hint "Exit the Firing Line";

 

 

//LANE 2 IS EXECUTED BY          nul=[] execVM "lanes\lane2.sqf";

_inc     = 0;
_count   = 0;
_targets = [l21, l22, l23, l24, l25, l26, l27, l28];
_many    =  count _targets;
nopop=true;
{_x  animate["terc",1]} forEach _targets;

hint "Setting up the Range";
sleep 9;
hint "Range Ready";
sleep 2;
hint "Switch Your Weapon From Safety to Semi";
sleep 2;
hint "Commence Fire";
sleep 2;

while {_inc<30} do 
{
_rnumber = random _many-.25;
_rtarget = _targets select _rnumber;
_rtarget animate["terc", 0];
sleep 3;
if (_rtarget animationPhase "terc" > 0.001) then
{
    _count = _count+1;
        };
  hintSilent format ["Targets :%1 Hit :%2",_inc+1,_count];
_rtarget animate["terc", 1];
_inc = _inc + 1;
};
if(_count <= 18) then {

          hint "SEE THE RSO";

};
if(_count >= 18) then {

          hint "Qualified MARKSMAN";

};
if(_count >= 22) then {

          hint "Qualified SHARPSHOOTER";

};
if(_count >= 27) then {

          hint "Qualified EXPERT";

};
sleep 5;
hint "Exit the Firing Line";

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

×