Jump to content
Sign in to follow this  
The_Oakster

Script running multiple times?

Recommended Posts

Hello fine sirs wink_o.gif

I have a manning script for an M2 called mangun.sqs that basically just gets a new man from the back-up team to man it when the current gunner is dead.

But I have 3 M2's and I was wondering if I need to rename the script to mangun1, 2 and 3 and or can i just get the 3 teams that are back up gunners to use the same script even though they may need it to run at different times?

The Oakster

Share this post


Link to post
Share on other sites

First of all, that depends on the script. Stick it up here and I'll have a look.

Second, this can be done much easier with Scripted WPs. Check www.ofpec.com for a tute (or maybe it was a thread, can't really remember) that explains Scripted WPs.

Share this post


Link to post
Share on other sites

Here you are:

_gun1 = _this select 0

_gnrs = _this select 1

#start

_gunner = gunner _gun1

?!alive _gunner : goto "nogunner"

? (getDammage _gun1) >= 1 : goto "dammaged"

#dammaged

exit

#nogunner

?"alive _x" count units _gnrs <= 0 :exit

_gunner = units _gnrs select (count units _gnrs - 1)

_gunner assignAsGunner _gun1

[_gunner] orderGetIn TRUE

;make him get in the gun

#check

?!alive _gunner : goto "nogunner"

~1

?!(_gunner in _gun1) : goto "check"

[_gunner] join grpnull

goto "start"

Share this post


Link to post
Share on other sites
Quote[/b] ]First of all, that depends on the script. Stick it up here and I'll have a look.

Second, this can be done much easier with Scripted WPs. Check www.ofpec.com for a tute (or maybe it was a thread, can't really remember) that explains Scripted WPs.

OK, if i remember correctly - it was a thread - and it was by:

well, by me smile_o.gif

Here you are:

http://www.ofpec.com/yabbse....start=0

But there's a much more easier way to do that;

Just give a group a GETIN waypoint which is placed exactly

onto an empty m2. Now one of them will mount the gun, and

once he gets killed, the next one will mount the gun - until

the group has been totally knocked out.

~S~ CD

Share this post


Link to post
Share on other sites

I think The_Oakster needs some help on the basic ideas behind using scripts. Oh yeah, and I wrote the script he's using, so I guess that makes this some sort of.... celebrity thread tounge_o.gif.

Oakster, I highly suggest that you read the following Tut, at least until the "Slightly More Complicated Stuff" section:

http://www.ofpec.com/editors/resource_view.php?id=13

That will do a better job explaining how scripts work than I can do, but I'll give it a quick shot anyway.

Anywho, the way you would call this script is like this:

[gun, group to man gun] exec "manMG.sqs"

You could put that line of code in the "init" field of a unit, or in the "on activation" field of a trigger. Now, you would take that line, and replace the words in the brackets [ ] with the actual name of the gun, and the name of the group to man the gun.

So, to make things easy for you, put this in the init field of the group leader who is going to man the gun:

[Gun1, group this] exec "manMG.sqs"

In the next group leader's init, just replace "Gun1" with the name of the next gun to be manned.

Share this post


Link to post
Share on other sites

hello,

@ Chris Death - I read that thread before I posted on here but i couldnt get that to work. When the loon dies no one else would man the gun sad_o.gif Thats the reason I tried a script...

@ General Barron - Cheers rock.gif . I dont need help on naming the script or to exec the script and I know what an "Init field" is and what an "On activation" field is too. So you dont need to "make it easy for me". wink_o.gif

All I wanted to know was if this script could be run by different groups with out renaming it ...1, ...2 and ...3. And in your rather condescending post you think it can be, so thank you.

Share this post


Link to post
Share on other sites

Condesending. rock.gif There must be a misunderstanding on both our parts, because I thought you were just unclear on sorta basic scripting stuff. I guess I'm missing something, because I don't see why it wouldn't be clear that it could be run on multiple guns, since you pass the gun to the script when you execute it.

Sorry, I was just trying to be helpful blues.gif

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  

×