Home   Help Search Login Register  

Author Topic: Flagfight/CTF flag system bugs  (Read 1346 times)

0 Members and 1 Guest are viewing this topic.

shadowknight

  • Guest
Flagfight/CTF flag system bugs
« on: 05 Nov 2003, 23:30:36 »
Hey guys..i need some help..i made a team flagfight..sorta..where you take the flag in the middle back to your scoring area..but if the flag is taken, and the flagowner dies..and someone picks the flag off the body..it wont show the flag taken text and he cant score it. Also..if the flag is taken and the flagowner dies..and the flag RETURNS to the post..and another player from that side takes the flag again...he cant score it.
heres the info...
When east/west player get within 2 feet of flag it changes to opposite side
position[]={5855.553711,89.379776,8615.811523};
a=5.000000;
b=5.000000;
activationBy="WEST";
repeating=1;
age="UNKNOWN";
text="flagchange E";
expActiv="flag1 setflagtexture ""ETACLAN.jpg""; flag1 setflagside East";
class Effects

position[]={5855.442871,89.386017,8615.958008};
a=5.000000;
b=5.000000;
activationBy="EAST";
repeating=1;
age="UNKNOWN";
text="flagchange w";
expActiv="flag1 setflagtexture ""ETACLAN.jpg""; flag1 setflagside west";
class Effects
This is the trigger over the flag scoring area that calls the capture.sqs script
position[]={5831.085938,99.967964,8895.675781};
a=5.000000;
b=5.000000;
activationBy="EAST";
repeating=1;
age="UNKNOWN";
text="east flag switch";
name="FlagswitchE";
expCond="(flagowner flag1) in thislist";
expActiv="[east] exec ""capture.sqs""";
class Effects
sound="Wcapture";

position[]={5996.326172,82.066711,8374.207031};
a=5.000000;
b=5.000000;
activationBy="ANY";
repeating=1;
age="UNKNOWN";
text="West Flag Switch";
name="flagswitchW";
expCond="(flagowner flag1) in thislist";
expActiv="[west] exec ""capture.sqs""";
sound="Ecapture";
Init
position[]={5840.090332,99.241562,8843.229492};
a=0.000000;
b=0.000000;
age="UNKNOWN";
text="Init";
expCond="true";
expActiv="wscore=0; escore=0; ownerW=objNull; ownerE=objNull; wflagtaken=false; Eflagtaken=false; timend=0";
sound="intro";
This trigger detects the flag taken and puts up the text
position[]={5878.331055,91.058128,8617.316406};
a=0.000000;
b=0.000000;
repeating=1;
age="UNKNOWN";
text="flagtaken";
expCond="not isnull flagowner flag1";
expActiv="titletext[format[""%1 has the Flag!"", name flagowner flag1], ""plain down""]; flagtaken=true";
sound="Wcapture";
This is the return system but it doesnt seem to work at all?!
position[]={5871.062500,95.867355,8648.938477};
a=0.000000;
b=0.000000;
repeating=1;
age="UNKNOWN";
text="returned west";
expCond="(isnull flagowner flag1) and wflagtaken";
expActiv="wflagtaken=false; titletext[format[""%1 Just Got Fucked In The Ass!"", name(Flagowner flag1)], ""plain down""];";

position[]={5875.404785,96.346031,8647.407227};
a=0.000000;
b=0.000000;
repeating=1;
age="UNKNOWN";
text="returned east";
expCond="(isnull flagowner flag1) and Eflagtaken";
expActiv="eflagtaken=false; titletext[format[""%1 Just Got Fucked In The Ass"", name (flagowner flag1)], ""plain down""]";
class Effects
and this is the capture.sqs file
_side = _this select 0
?!(local Server): goto "client"
?(_side == WEST): WestScore = WestScore + 1; PublicVariable "WestScore"
?(_side == EAST): EastScore = EastScore + 1; PublicVariable "EastScore"
#client
?(_side == WEST): goto "wclient"
?(_side == EAST): goto "eclient"
#wclient
wscore=wscore+1
titleText [format["%1 has captured the East flag!", name (flagowner flag1)], "PLAIN DOWN"]
flag1 setFlagOwner objNull
(flagOwner flag1) setFlagOwner objNull
goto "end"
#eclient
escore=escore+1
titleText [format["%1 has captured the West flag!", name (flagowner flag1)], "PLAIN DOWN"]
flag1 setFlagOwner objNull
(flagOwner flag1) setFlagOwner objNull
goto "end"
#end
~10
titleText [format["West:  %1  East: %2", WScore, EScore], "PLAIN DOWN"]
exit

-Props to OFPEC...you guys do a great job!
spliff

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Flagfight/CTF flag system bugs
« Reply #1 on: 06 Nov 2003, 19:28:11 »
triggers are a mess, this does all that your tiggers do and causes less lag. looping at its fastest rate of 0.5 of a second instead of multiple triggers looping at a much faster rate

1) Name your flags EFlag and WFlag
execute the following script from your init.sqs by entering the following line
[] exec "Eflag.sqs"
[] exec "Wflag.sqs"
and
and create a similar script for West flag

Quote
;;EFlag.sqs
;;CTF Script for East's flag
;;Name East flag EFlag
?(isnull EFlag):hint "Object EFlag does not exist";goto "DeBug"
EFlag SetFlagSide East
EFlag setflagtexture "rus_vlajka.pac"  
EFlag setFlagOwner objNull
goto "start"

#start
~0.5
EFlagrunner = FLAGOWNER EFlag
?(isnull EFlagrunner ):Goto "START"
?(Alive EFlagrunner ):Goto "FLAGTAKEN"
?!(Alive EFlagrunner ):Goto "DEADHASFLAG"
hint "Debug: Eflag,sqs/start section":goto "DEBUG"


#FLAGTAKEN
?(Side Player==West):titletext[format["%1 has East's Flag!",name EFlagrunner],"PLAIN DOWN"];PlaySound "fanfare"
;;?(Side Player==East):titletext[format["Our Flag is missing"],"PLAIN DOWN"];PlaySound "fanfare"
Goto "LOOP"

#LOOP
~0.5
?!(Alive EFlagrunner):goto "DEADHASFLAG"  
?(isnull Flagowner WFlag) and EFlagrunner distance WFlag<5:goto "WCaps"  
Goto "LOOP"

#WCaps

?(Side Player == West):titletext[format["%1 capped a flag!",name EFlagrunner],"PLAIN DOWN"]
?(Side Player == East):titletext[format["The enemy has scored"],"PLAIN DOWN"]
PlaySound "gong"
?(local Server):WScore = WScore + ctf_Score; PublicVariable "WScore" "
Goto "ShowScore"

#ShowScore
?(local Server):ShowScore=true; PublicVariable "ShowScore"
Goto "FLAGRETURN"

#FlagReturn
EFlag SetFlagSide East
hint format ["East's Flag \n has been returned"]
EFlag setFlagOwner objNull  

Goto "start"

#DEADHASFLAG

_count = 1
?(!Alive EFlagrunner)&&(Side Player == West)&& !(player==EFlagrunner):titletext[format["Our Flagrunner is dead\nWe have %1 seconds to retrieve it",FLAGRETURNDELAY],"PLAIN DOWN"]
?!(Alive EFlagrunner)&&(Side Player == EAST):titletext[format["Enemy flagrunner is dead!"],"PLAIN DOWN"]
#deadloop
~0.5
_count = _count + 0.5
EFlagrunner = FLAGOWNER EFlag
?(Alive EFlagrunner ):goto "start"
?(_count == FLAGRETURNDELAY):goto "FLAGRETURN"
goto "DEADLOOP"



#Debug
~5
hint "Eflag_CTF script exiting"
goto "END"
 
#end
Exit

declare the following in the init.sqs
WScore = 0
EScore = 0
ctf_Score = (Whatever points you want to award a flag cap)
FLAGRETURNDELAY = (Timespan for auto return of a flag from a dead player, standard used by most folks is 120 (2 minutes)

make sure you have added a gamelogic which you named "Server"


edit the following line to show your score message using a hint line or titletext message
?(local Server):ShowScore=true; PublicVariable "ShowScore"
or simply run the following script from the init.sqs using

[]exec "Scoremessage.sqs"

Quote
;;scoremessage.sqs
ShowScore=false
ShowTime=false
 
#start
~1
?(ShowScore):goto "ShowScore"
?(ShowTime):goto "ShowTime"  
Goto "start"
 
#ShowScore
~3
?!(ShowScore):goto "start"
TimeRemain = TimeRemain - (TimeRemain mod 1)
hint format["MISSION STATUS:\n\%1 <--> East %2\n\n%3 mins remaining",WScore,EScore,TimeRemain]


ShowScore=false
Goto "start"
 
#ShowTime
TimeRemain = TimeRemain - (TimeRemain mod 1)
_timemessage=Format["%1 minutes remaining",TimeRemain]
Hint _timemessage
ShowTime=false
goto "start"
 
#End
Exit

and that should be all that is needed,  uses no triggers


oh 1 more thing, the lines that say playsound "XXXX" eg "Fanfare"  need to be edited to whatever sound file you want played for a flag cap etc etc"
« Last Edit: 06 Nov 2003, 19:31:08 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

shadowknight

  • Guest
Re:Flagfight/CTF flag system bugs
« Reply #2 on: 07 Nov 2003, 18:10:42 »
but...how do i do that with only ONE(1) flag? how do i make the scripts work both ways for the same flag?

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Flagfight/CTF flag system bugs
« Reply #3 on: 09 Nov 2003, 13:03:38 »
make the flagside resistance to start with if using east and west sides, then develop the two ctf scripts into one script.

The best way to learn is try, all the information is in that post, apart from what i just stated about making the flag on the pole, setside guerrila
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

shadowknight

  • Guest
Re:Flagfight/CTF flag system bugs
« Reply #4 on: 10 Nov 2003, 05:42:42 »
i got it up and running...thanks for the help terox! ;D