View Full Version : How to return the flag when it\'s lost?
Capitaine Haddock
Nov 14 2001, 15:37
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 http://www.flashpoint1985.com/ikonboard3/non-cgi/emoticons/smile.gif
Dan "Haddock
Damage Inc
Nov 14 2001, 16:06
You could use the setpos command. Someone else can probably tell more.
Capitaine Haddock
Nov 14 2001, 23:16
I'll try to finf info on that "setpos" command. Thanks Damage!
mycroftsoft
Jun 29 2002, 22:48
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
InqWiper
Jun 30 2002, 13:59
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 http://www.flashpoint1985.com/ikonboard301/iB_html/non-cgi/emoticons/smile.gif
InqWiper
Jun 30 2002, 14:01
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"
mycroftsoft
Jun 30 2002, 21:25
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?http://www.flashpoint1985.com/ikonboard301/iB_html/non-cgi/emoticons/confused.gif??
(what will the flagowner command do return?http://www.flashpoint1985.com/ikonboard301/iB_html/non-cgi/emoticons/confused.gif?http://www.flashpoint1985.com/ikonboard301/iB_html/non-cgi/emoticons/confused.gif)
please tell me...
(i m gonna also try the code i wrote to return the flags....
mycroftsoft
Jun 30 2002, 23:57
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
InqWiper
Jul 1 2002, 02:43
</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 :]
[/QUOTE]<span id='postcolor'>
NP http://www.flashpoint1985.com/ikonboard301/iB_html/non-cgi/emoticons/smile.gif
Thx for learning me a new thing with scripting:
_nb=_nb+1
? ( _nb < 60 )
http://www.flashpoint1985.com/ikonboard301/iB_html/non-cgi/emoticons/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 http://www.flashpoint1985.com/ikonboard301/iB_html/non-cgi/emoticons/smile.gif
mycroftsoft
Jul 1 2002, 12:00
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
theavonlady
Jul 1 2002, 12:12
</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (mycroftsoft @<hidden> July 01 2002,15:00)</td></tr><tr><td id="QUOTE">LOOP is the very basic thing when you learn programming.[/QUOTE]<span id='postcolor'>
From "The Programmer's Dictionary":
loop [1] (luep) n., v. <looped, loop-ing>
n.
See "loop".
http://www.flashpoint1985.com/ikonboard301/iB_html/non-cgi/emoticons/tounge.gif
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.