Jump to content
Sign in to follow this  
=101AD=Richard

Pop up targets Script

Recommended Posts

Ok I want to make this script not use Hint, I would like to to use Either a local player and one other player, how would I do this, or If I could just put it in sidechat? thank you for any help

_inc     = 0;
_count   = 0;
_targets = [pt1, pt1_1, pt1_2, pt1_3, pt1_4, pt1_5, pt1_6, pt1_7, pt1_8, pt1_9, pt1_10, pt1_11];
_many    =  count _targets;
nopop=true;
{_x  animate["terc",1]} forEach _targets;

hint "Welcome to the 101st Airborne's 1st Live Fire Rifle Qualification Range";
sleep 5;
hint "Setting up the Range";
sleep 3;
hint "The Qualification Course will begin in 10 Seconds";
sleep 2;
hint "The Qualification Course will begin in 8 Seconds";
sleep 2;
hint "The Qualification Course will begin in 6 Seconds";
sleep 2;
hint "The Qualification Course will begin in 4 Seconds";
sleep 2;
hint "The Qualification Course will begin in 2 Seconds";
sleep 2;
hint "Begin!";


while {_inc<20} do 
{
_rnumber = random _many-1;
_rtarget = _targets select _rnumber;
_rtarget animate["terc", 0];
sleep 6;
if (_rtarget animationPhase "terc" > 0.1) then
{
	_count = _count+1;
	    };
  hint 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

Also replace this line

_rnumber = random _many-1;

with this one

_rnumber = floor random _many;

Other wise the some targets may not get counted.

Share this post


Link to post
Share on other sites

Hello,

I've a question.

How do I get it objective completed after I get a number of hits?

The script doesn't work anymore if I use the succeeded command.

Any idea's?

Share this post


Link to post
Share on other sites

I just tried adding the succeeded command it works as it should.

I also rearranged a few lines of script as the score was a bit behind the targets.

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: TODO: Author Name
//////////////////////////////////////////////////////////////////
//                 How to use. 
// 1. Place a popup target and name it to pt1 
// 2. copy it 8 times and it will auto name the targets
// 3. place this line in a trigger or init  nul=[] execVM "popup.sqf" 

_inc     = 0;
_count   = 0;
_pass    = 15; // number of targets you  are required to hit. 
_targets = [pt1, pt1_1, pt1_2, pt1_3, pt1_4, pt1_5, pt1_6, pt1_7, pt1_8, pt1_9, pt1_10, pt1_11];

_many    =  count _targets;
nopop=true;
{_x  animate["terc",1]} forEach _targets;

hint "Welcome to the 101st Airborne's 1st Live Fire Rifle Qualification Range";
sleep 5;
hint "Setting up the Range";
sleep 3;
hint "The Qualification Course will begin in 10 Seconds";
sleep 2;
hint "The Qualification Course will begin in 8 Seconds";
sleep 2;
hint "The Qualification Course will begin in 6 Seconds";
sleep 2;
hint "The Qualification Course will begin in 4 Seconds";
sleep 2;
hint "The Qualification Course will begin in 2 Seconds";
sleep 2;
hint "Begin!";



while {_inc < 20} do 
{
_inc = _inc + 1;
_rnumber = floor random _many;
_rtarget = _targets select _rnumber;
_rtarget animate["terc", 0];
sleep 1;
hintsilent format ["Targets :%1 Hit :%2",_inc,_count];
sleep 1;
if (_rtarget animationPhase "terc" > 0.1) then
{
	_count = _count+1;
	    };

  hint format ["Targets :%1 Hit :%2",_inc,_count];
_rtarget animate["terc", 1];
sleep 1;
};

sleep 2;
hint "Session Complete";
sleep 1;

hint format ["%1",_count];
if  (_count >= _pass ) then {Hint "Congratulations you have passed";MAG_tskObj0 settaskState "SUCCEEDED"} else {hint "Sorry you must do better";MAG_tskObj0 settaskState "FAILED"}; 

Share this post


Link to post
Share on other sites

Hwo could I make this scrip so a group of 3 targets go up and down, always the same 3 such as the 3 in a bunker, also can I addto this script so a vehicle will appear and also a smoke gernade will pop sometimes, and other times that a chopper will lock onto some things auto

Share this post


Link to post
Share on other sites
I just tried adding the succeeded command it works as it should.

I also rearranged a few lines of script as the score was a bit behind the targets.

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: TODO: Author Name
//////////////////////////////////////////////////////////////////
//                 How to use. 
// 1. Place a popup target and name it to pt1 
// 2. copy it 8 times and it will auto name the targets
// 3. place this line in a trigger or init  nul=[] execVM "popup.sqf" 

_inc     = 0;
_count   = 0;
_pass    = 15; // number of targets you  are required to hit. 
_targets = [pt1, pt1_1, pt1_2, pt1_3, pt1_4, pt1_5, pt1_6, pt1_7, pt1_8, pt1_9, pt1_10, pt1_11];

_many    =  count _targets;
nopop=true;
{_x  animate["terc",1]} forEach _targets;

hint "Welcome to the 101st Airborne's 1st Live Fire Rifle Qualification Range";
sleep 5;
hint "Setting up the Range";
sleep 3;
hint "The Qualification Course will begin in 10 Seconds";
sleep 2;
hint "The Qualification Course will begin in 8 Seconds";
sleep 2;
hint "The Qualification Course will begin in 6 Seconds";
sleep 2;
hint "The Qualification Course will begin in 4 Seconds";
sleep 2;
hint "The Qualification Course will begin in 2 Seconds";
sleep 2;
hint "Begin!";



while {_inc < 20} do 
{
_inc = _inc + 1;
_rnumber = floor random _many;
_rtarget = _targets select _rnumber;
_rtarget animate["terc", 0];
sleep 1;
hintsilent format ["Targets :%1 Hit :%2",_inc,_count];
sleep 1;
if (_rtarget animationPhase "terc" > 0.1) then
{
	_count = _count+1;
	    };

  hint format ["Targets :%1 Hit :%2",_inc,_count];
_rtarget animate["terc", 1];
sleep 1;
};

sleep 2;
hint "Session Complete";
sleep 1;

hint format ["%1",_count];
if  (_count >= _pass ) then {Hint "Congratulations you have passed";MAG_tskObj0 settaskState "SUCCEEDED"} else {hint "Sorry you must do better";MAG_tskObj0 settaskState "FAILED"}; 

Works like a charm. Thanks man. now I can finally finish my objective...

Share this post


Link to post
Share on other sites
Hwo could I make this scrip so a group of 3 targets go up and down, always the same 3 such as the 3 in a bunker, also can I addto this script so a vehicle will appear and also a smoke gernade will pop sometimes, and other times that a chopper will lock onto some things auto

This script will now popup groups of three, the number of targets should be divisible by 3.

Save it with a new name.

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: TODO: Author Name
//////////////////////////////////////////////////////////////////
//                 How to use. 
// 1. Place a popup target and name it to pt1 
// 2. copy it several times and it will auto name the targets
// 3. place this line in a trigger or init  nul=[] execVM "popup3set.sqf" 
// This script will pop up 3 targets at a time.

_inc     = 0;
_count   = 0;
_pass    = 20; // number of targets you  are required to hit. 
_targets = [pt1, pt1_1, pt1_2, pt1_3, pt1_4, pt1_5, pt1_6, pt1_7, pt1_8, pt1_9, pt1_10, pt1_11];
//_targets = [pt1, pt1_1, pt1_2, pt1_3, pt1_4, pt1_5, pt1_6, pt1_7,pt1_8];
_many    =  (count _targets)/3;
nopop=true;
{_x  animate["terc",1]} forEach _targets;

hint "Welcome to the 101st Airborne's 1st Live Fire Rifle Qualification Range";
sleep 5;
hint "Setting up the Range";
sleep 3;
hint "The Qualification Course will begin in 10 Seconds";
sleep 2;
hint "The Qualification Course will begin in 8 Seconds";
sleep 2;
hint "The Qualification Course will begin in 6 Seconds";
sleep 2;
hint "The Qualification Course will begin in 4 Seconds";
sleep 2;
hint "The Qualification Course will begin in 2 Seconds";
sleep 2;
hint "Begin!";



while {_inc < 10} do 
{
_inc = _inc + 1;
_rnumber = floor random _many;
_rnumber = _rnumber *3;
_rtarget1 = _targets select _rnumber+0;
_rtarget2 = _targets select _rnumber+1;
_rtarget3 = _targets select _rnumber+2;
_rtarget1 animate["terc", 0];
_rtarget2 animate["terc", 0];
_rtarget3 animate["terc", 0];

sleep 1;
hintsilent format ["Targets :%1 Hit :%2",_inc*3,_count];
sleep 2;
if (_rtarget1 animationPhase "terc" > 0.1) then
{
	_count = _count+1;
	    };
if (_rtarget2 animationPhase "terc" > 0.1) then
{
	_count = _count+1;
	    };
if (_rtarget3 animationPhase "terc" > 0.1) then
{
	_count = _count+1;
	    };
 hint format ["Targets :%1 Hit :%2",_inc*3,_count];
_rtarget1 animate["terc", 1];
_rtarget2 animate["terc", 1];
_rtarget3 animate["terc", 1];


sleep 1;
};

sleep 2;
hint "Session Complete";
sleep 1;

hint format ["%1",_count];
if  (_count >= _pass ) then {Hint "Congratulations you have passed";MAG_tskObj0 settaskState "SUCCEEDED"} else {hint "Sorry you must do better";MAG_tskObj0 settaskState "FAILDED"}; 

You could spawn a smoke shell

smoke = "SmokeShell" Createvehicle  (position location);  

location would be a game logic or trigger name.

In what context would you like the vehicle to appear, as for the chopper I would avoid that as they are so unpredictable.

just for a bit of fun I've add a simple sound when the targets pop up.

If you want to try it just download the file and save the description.sqf and sound folder to the mission folder.

Then add the following line _rtarget1 say ["clunk",0]; after this one in the script _rtarget3 animate["terc", 0];

http://www.sendspace.com/file/uemn4l

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Just say a lockable target, something so they dont see it coming, but for it to appear at a random time and disappear afterwards

Share this post


Link to post
Share on other sites

Ok I want to have a Close air support range on the same type asa rifle range, that some pop up targets can pop up but also some lockable armor targets can appear randomly and disappear after destroyed.

Share this post


Link to post
Share on other sites

Well there is a lockable tank target although it would have to be done in another way completely. I think I'll pass on that one myself.

Share this post


Link to post
Share on other sites
Well there is a lockable tank target although it would have to be done in another way completely. I think I'll pass on that one myself.

Lol ok thank you for the help

Share this post


Link to post
Share on other sites

I can not get this popup script to work right on a dedicated server. I changed a few things in the script for personal use.

What is happening is the target I just shot will pop back up sometimes, then I have two targets.

Is it because I changed the ammount of time the target stays up?

_SoldierOne  = player;
_inc     = 0;
_count   = 0;
_pass    = 5; // number of targets you  are required to hit. 
_targets = [pt1, pt1_1, pt1_2, pt1_3, pt1_4, pt1_5, pt1_6, pt1_7];

_many    =  count _targets;
nopop=true;
{_x  animate["terc",1]} forEach _targets;

_soldierOne groupChat "Welcome to the firing range";
sleep 5;
_soldierOne groupChat "Setting up the Range";
sleep 2;
_soldierOne groupChat "The Qualification Course will begin in 2 Seconds";
sleep 2;
_soldierOne groupChat "Begin!";



while {_inc < 10} do // number to popup
{
_inc = _inc + 1;
_rnumber = floor random _many;
_rtarget = _targets select _rnumber;
_rtarget animate["terc", 0];
sleep 1;
_soldierOne groupChat format ["Targets :%1 Hit :%2",_inc,_count];
sleep 5; // target stays up for this time
if (_rtarget animationPhase "terc" > 0.1) then
{
	_count = _count+1;
	    };

_soldierOne groupChat format ["Targets :%1 Hit :%2",_inc,_count];
_rtarget animate["terc", 1];
sleep 1;
};

sleep 2;
_soldierOne groupChat "Session Complete";
sleep 1;

_soldierOne commandChat format ["%1",_count];
if  (_count >= _pass ) then {_soldierOne commandChat "Congratulations you have passed";} else {_soldierOne commandChat "Sorry you must do better";};

Share this post


Link to post
Share on other sites

I don't really think it will work correctly as the scores will be broadcast globally anyway.

I've not done any MP script but you will need to work out if the script needs to run on the server, client or all three.

To do that you use

if (!isServer) then {maincode};

if (isServer) then {maincode};

if (!isServer) exitwith {};

if (isServer) exitwith {};

Also it's possible to just have certain parts run in this way.

I would imagine it should be run on the client only.

I tested the script in SP and had no double popup, were your running MP at the time.

The first two sever commands I listed would look something like this..

if   (!isServer) then {
_SoldierOne  = player;
_inc     = 0;
_count   = 0;
_pass    = 5; // number of targets you  are required to hit. 
_targets = [pt1, pt1_1, pt1_2, pt1_3, pt1_4, pt1_5, pt1_6, pt1_7];

_many    =  count _targets;
nopop=true;
{_x  animate["terc",1]} forEach _targets;

_soldierOne groupChat "Welcome to the firing range";
sleep 5;
_soldierOne groupChat "Setting up the Range";
sleep 2;
_soldierOne groupChat "The Qualification Course will begin in 2 Seconds";
sleep 2;
_soldierOne groupChat "Begin!";



while {_inc < 10} do // number to popup
{
_inc = _inc + 1;
_rnumber = floor random _many;
_rtarget = _targets select _rnumber;
_rtarget animate["terc", 0];
sleep 1;
_soldierOne groupChat format ["Targets :%1 Hit :%2",_inc,_count];
sleep 5; // target stays up for this time
if (_rtarget animationPhase "terc" > 0.1) then
{
	_count = _count+1;
	    };

_soldierOne groupChat format ["Targets :%1 Hit :%2",_inc,_count];
_rtarget animate["terc", 1];
sleep 1;
};

sleep 2;
_soldierOne groupChat "Session Complete";
sleep 1;

_soldierOne commandChat format ["%1",_count];
if  (_count >= _pass ) then {_soldierOne commandChat "Congratulations you have passed";} else {_soldierOne commandChat "Sorry you must do better";};
};

Share this post


Link to post
Share on other sites

Thanks for the fast reply. The scores work great. I am using addaction to start script. I tried your older version using the if (!isServer) then {maincode}; I will give it a try on this one.

Hosted locally it works great though.

Share this post


Link to post
Share on other sites

I finally got it!

I was trying everything. I dont know why but they kept poping back up. I had to move the nopop=true; to the my init.sqf Why? I have no idea. I did try if (isServer) then and I also tried if (isMultiplayer) then. Neither worked.

I figured it out by putting the nopop=true in a radio trigger. It worked after I called the script and they kept poping so I hit the radio trigger and it worked great. I really hate locality stuff. I do not understand why your example above did not work. Whats different from nopop being run from the init or a script.

It was like the server was not running the nopop but my machine was. Maybe because it was being called from an addaction. Thats it. I think I figured out now lol. Why didnt I think of that 4 hours ago

Share this post


Link to post
Share on other sites

Hello,

The script will pop up 3 targets as it is suppose to do. But is there any way to make the three in the same area? Kind of like a group of 3 close to each other.

Thanks in advance for your assistance.

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  

×