Jump to content
Sign in to follow this  
Johnston -506th PIR-

Looking for a popup target 'reset' script

Recommended Posts

I'm working on target ranges for various weapons and am looking for a script that will reset the blue (simple) popup targets with a radio call from a specific playable unit (ex, range instructor role).

I've been told this would be a fairly simply script and I know that there were a few out there for ArmA1, however I have not been able to find them.

I'm not much of a script-er myself, but am beginning to learn, just takes time to learn the syntax.

What I'm looking for is some help on where I should start of if anyone knows a script like this,link meh please.

Thank you

CPL J. Johnston [506th PIR]

www.506th-pir.org

Share this post


Link to post
Share on other sites

UnPBO misc.pbo (it's small)

You'll find popuptarget.sqf (and a sqs one too)

To reset the target, it uses:

_target animate["terc", 0];

You may also want to set

nopop=true;

to prevent the targets from popping up on their own.

Create a trigger in the editor

Size: encompass the desired targets

Activation: Anybody, repeatedly

Condition:

!isNil "PIR_resetpop"

Activation:

{if(_x isKindOf "TargetBase") then {_x setDamage 0; _x animate["terc", 0]}} forEach thislist; PIR_resetpop=Nil;

Second trigger

Activation: Radio Alpha, repeatedly

Condition: this

Activation: PIR_resetpop=true; publicVariable "PIR_resetpop";

init.sqf

1 setRadioMsg "NULL";

PIR_instructors = [unitname1,unitname2];

{1 setRadioMsg "Reset Targets"} forEach PIR_instructors;

If you want to reuse the radio slot on different units, you can run createTrigger locally on the client to create the Radio Trigger.

Edited by tcp

Share this post


Link to post
Share on other sites

First, thank you for your help tcp. Unfortunately I haven't been able to get any of this to work. Therefore I'm going to illustrate everything I've done so far.

My Mission has three files right now, Mission.sqm, PIR_resetpop.sqf, and init.sqf

Unless mission.sqm needs anything in it regarding the popup reset, I'm going to leave that out.

PIR_resetpop.sqf reads

/*

File: PopUpTarget.sqf

Author: BIS

Description:

Script to make the pop-up target actually pop back up.

Parameter(s):

_this select 0: the pop-up target object.

*/

private ["_target"];

_target = _this select 0;

_target setDamage 0;

nopop=true;

scopeName "root";

if ((_target animationPhase "terc") <= 0) then

{

_target animate["terc", 1];

if (!isNil "nopop") then

{

if (nopop) then

{

breakTo "root"

};

};

sleep 3;

if (!isNil "nopop") then

{

if (nopop) then

{

breakTo "root";

};

};

if (alive _target) then

{

_target animate["terc", 0];

};

};

true

And because I dont have respawn or anything else in right now, Init.sqf reads:

1 setRadioMsg "NULL";

PIR_instructors = [instructor1,instructor2];

{1 setRadioMsg "Reset Targets"} forEach PIR_instructors;

In the mission, I have various simple popups (blue) with a couple of the small popups (red), just because I didnt know which would be effected by this script.

I also have 2 riflemen (1 player, 1 playable), named "instructor1" and "instructor 2"

Encompassing the entire range, I have the two triggers listed above, unnamed with only the specifications you listed me above.

When I preview the mission and drop a few of the targets, the blue ones stay down as they are supposed to, and the red pops back up as it is default supposed to. I have the radio option for "reset targets", however nothing happens to either kind of popup.

What have I done wrong or is more information required? Please and thank you.

P.S. I used the .sqf from misc.pbo, not the .sqs

Share this post


Link to post
Share on other sites

The script Tcp provided you with will work only with the red targets.

The OFP-era blue ones simply require you to reset their damage back to 0:

resetTargets.sqf:

_targets = [t1, t2, t3]; //Put all the targets' names here

{
   _x setDamage 0;
} forEach _targets;

Then simply set the radio trigger's on activation field to:

null = execVM "resetTargets.sqf";

Share this post


Link to post
Share on other sites

You could try using a simple trigger for a target or a few of them (1 trigger each).

If your using the blue static target which can only get shot once its easy.

Name your blue target (example: target1)

Trigger:

set the trigger to repeatedly..

set the three time out boxes to any time value you want the target to say down before it comes back up (make sure all three values are the same, so its not random)

in conditions type..

damage target1 >= 1

in activation type..

target1 setdamage 0;

and thats it. That will work for 1 target. For more, make more triggers and targets and change the name of each target.

Hope that helps.

Share this post


Link to post
Share on other sites

Thank you Deadfast and General Carver.

Deadfast, I got yours to work and it is quite simple, yet teadious but that's expected with this sort of thing ;P. I prefer using the blue targets and I just needed to get all targets (~100 for each range) reset at the same time (they are for qualifications for our enlisted members). It works perfectly.

General Carver, I also like your method. I haven't implemented it but it may work well for the Sniper and 203 Ranges I am working, as the random event you mentioned would work well for those.

Once again thank you both and if there is ever something either of you need, please let me know. The 506th has vast resources (tangible, digital and general military knowledge/experience).

Share this post


Link to post
Share on other sites

How do you link radio message only to player named "hq" so other MP players can't reset targets?

Share this post


Link to post
Share on other sites
;1504907']

Deadfast' date=' I got yours to work and it is quite simple, yet teadious but that's expected with this sort of thing ;P. I prefer using the blue targets and I just needed to get all targets (~100 for each range) reset at the same time (they are for qualifications for our enlisted members). It works perfectly.

[/quote']

Didn't know you have 100 of them :)

This would probably be a better option then:

Create a game logic in the middle of the range and put this in its init field:

JOHN_targets = nearestObjects [this, ["TargetE"], 100];

(The 100 is the radius within which the command will look for the targets. Change to a number that just about covers all your targets)

Then change resetTargets.sqf to:

{
   _x setDamage 0;
} forEach JOHN_targets;  

Share this post


Link to post
Share on other sites

I had problems with getting the blue targets to stand up again for someone who would join in progress, so if you get that working please let me know! They would see them as up again, but you wouldn't, or something like that.

The red targets with their animate state work better. Check out "doopopup" in my Example Scripts.

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  

×