Jump to content
Sign in to follow this  
Capitaine Haddock

How to return the flag when it\'s lost?

Recommended Posts

I'm using the mission wizard to create CTF games. Everything works fine, but sometimes the flag gets lost in the water when the flag carrier is killed over it.

Do you know how to make the flag return to the flagpole after a given time?

Any bit of code I could drop on my MISSION.SQM?

Thanks in advance smile.gif

Dan "Haddock

Share this post


Link to post
Share on other sites

i would like to know how too.....

it does the same thing in BIS CTF missions.....

but can t get the code from the BIS missions.....

if someone could put the condition to return the flag

if east or west flagowner die

and so returning it of nobody take it back after 10 seconds....

thx

Share this post


Link to post
Share on other sites

I couldnt do it with triggers but I made a script that I think will work pretty well.

This script will return the flag if the flagowner has been dead for one minute, but if someone takes the flag and gets killed within 5 seconds theres a chance that the timer wount start over again but just keep counting to 1 minut and then return the flag.

#Start

?(alive flagOwner FlagWest) : goto "Start"

~5

?(alive flagOwner FlagWest) : goto "Start"

~5

?(alive flagOwner FlagWest) : goto "Start"

~5

?(alive flagOwner FlagWest) : goto "Start"

~5

?(alive flagOwner FlagWest) : goto "Start"

~5

?(alive flagOwner FlagWest) : goto "Start"

~5

?(alive flagOwner FlagWest) : goto "Start"

~5

?(alive flagOwner FlagWest) : goto "Start"

~5

?(alive flagOwner FlagWest) : goto "Start"

~5

?(alive flagOwner FlagWest) : goto "Start"

~5

?(alive flagOwner FlagWest) : goto "Start"

~5

?(alive flagOwner FlagWest) : goto "Start"

~5

?(alive flagOwner FlagWest) : goto "Start"

FlagWest setflagowner FlagWest

goto "Start"

If you want the flag to be returned after 5 min and you dont want the timer to be able to keep counting though someone managed to take the flag off the dead guy and hold it for almost 5 secs you can do this.

?(alive flagOwner FlagWest) : goto "Start"

~1

Then the timer could keep counting if the guy takes the flag and dies within 1 sec but it could also start counting from start again.

just copy that and paste it into the script 300 times.

Im not the best scripter but this is what I could come up with with just the basic stuff that I learned from basic camera scripting and what I´ve read in the comref smile.gif

Share this post


Link to post
Share on other sites

Forgot to say that "FlagWest" is the name of the flagpole and U have to exec the script.

Just put this in the flagpoles init field(or any unit):

this exec "ScriptName.sqs"

Share this post


Link to post
Share on other sites

got a better way to do it

create 2 triggers :

one to begin west flagowner check and one another for east

put in one of the 2 trigger (west one):

condition : !alive flagowner westflag

on activation : [] exec "returnwestflag.sqs"

and for the another one (east one) :

condition : !alive flagowner eastflag

on activation : [] exec "returneastflag.sqs"

returnwestflag.sqs :

#loop

_nb=0

~0.001

#nextloop

?(alive flagOwner FlagWest) : goto "loop"

~1

_nb=_nb+1

? ( _nb < 10 ) : goto "nextloop"

FlagWest setflagowner objnull

goto "loop"

returneastflag.sqs :

#loop

_nb=0

~0.001

#nextloop

?(alive flagOwner Flageast) : goto "loop"

~1

_nb=_nb+1

? ( _nb < 10 ) : goto "nextloop"

Flageast setflagowner objnull

goto "loop"

but there will have another problem....

what will happen if the flag has returned?confused.gif??

(what will the flagowner command do return?confused.gif?confused.gif)

please tell me...

(i m gonna also try the code i wrote to return the flags....

Share this post


Link to post
Share on other sites

thx man now i did it :]

it works all good.

do it as follow :

usflag is the name of the westflag

and rusflag the name of the eastflag

make a trigger for west,

put in condition field : !alive flagowner usflag

and in the activation field : [] exec "returnwestflag.sqs"

make it triggered reapeatedly

and for east,

put in condition field : !alive flagowner rusflag

and in the activation field : [] exec "returneastflag.sqs"

make it triggered reapeatedly

then in the scripts,

*************  returnwestflag.sqs ***************

#loop

_nb=0

~0.001

#nextloop

?(alive flagOwner usflag) : goto "end"

~1

_nb=_nb+1

? ( _nb < 60 ) : goto "nextloop"

usflag setflagowner objnull

CutText ["THE WEST FLAG HAS BEEN RETURNED...","PLAIN",2]

~6

CutText ["","PLAIN",0]

#end

exit

*********************************************

*************  returneastflag.sqs ***************

#loop

_nb=0

~0.001

#nextloop

?(alive flagOwner rusflag) : goto "end"

~1

_nb=_nb+1

? ( _nb < 60 ) : goto "nextloop"

rusflag setflagowner objnull

CutText ["THE EAST FLAG HAS BEEN RETURNED...","PLAIN",2]

~6

CutText ["","PLAIN",0]

#end

exit

*********************************************

PS :

? ( _nb < 60 ) : goto "nextloop"

60 will be aproximatively the time in seconds before returning the flag if nobody get it.

thx InqWiper to have put me in the good way :]

greetings from [sOD] HLQ2ACTION

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">thx InqWiper to have put me in the good way :]

<span id='postcolor'>

NP  smile.gif

Thx for learning me a new thing with scripting:

_nb=_nb+1

? ( _nb < 60 )

smile.gif

I didnt understand what it did at first but it looks like everytime it passes by that point +1 is added to _nb and after it has passed over it 60 times "?(_nb <60)" is no longer true and it wount "goto "Nextloop"".

This way U dont have to copy and paste as much as I do  smile.gif

Share this post


Link to post
Share on other sites

yeah this kind of jump is called a

LOOP

in x86 assembly language.

in x86 asm you have to put in CX the number of times ot will loop.

here it s the same thing but you don t have a loop :[

you have to make it yourself...

LOOP is the very basic thing when you learn programming.

most of the time if you like scripting then you ll love programming...

even if programming is a bit more harder.

remember that i m just making a counter with this fist line :

_nb=_nb+1

and that you can do LOT of things with scripting, there is LOT of mathematical things to use.

he

greetings from [sOD] HLQ2ACTION

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (mycroftsoft @ July 01 2002,15:00)</td></tr><tr><td id="QUOTE">LOOP is the very basic thing when you learn programming.<span id='postcolor'>

From "The Programmer's Dictionary":

loop [1] (luep) n., v. <looped, loop-ing>

n.

See "loop".

tounge.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  

×