Home   Help Search Login Register  

Author Topic: CTF Problem  (Read 4732 times)

0 Members and 1 Guest are viewing this topic.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:CTF Problem
« Reply #15 on: 27 Jan 2003, 16:02:12 »
Here is my version of Karrilions CTF script
(You can take the flag from a dead flag runner and score with it)


I havent added the Show message.sqs, or the timer.sqs, just the part you are having problems with.

Simply delete the old ctf.sqs and replace it with this one


ctf.sqs
Quote
;;CTF.sqs (this is the heart of the scoring and such)
 
;;CTF script by KaRRiLLioN
;;Modified by terox with dead flag runner fix
;;This selects the flag's name
 
_flag = _this select 0
?(isnull _flag):goto "end"
 
?(_flag==FlagW):_flag SetFlagSide WEST
?(_flag==FlagE):_flag SetFlagSide EAST
FlagW setflagtexture "usa_vlajka.pac"
FlagE setflagtexture "\flags\vietnam.jpg"  
?(_flag==FlagW):_flagname="the GI Joes Flag"
?(_flag==FlagE):_flagname="the NVA's Flag"
_flag setFlagOwner objNull
goto "start"

#DeadHasFlag
_count = 1
?(isnull Flagowner FlagW) and _flagownerside==WEST:titletext[format["Hail the fallen HERO\n%1\n %2 is lying on his blood soaked corpse\n You have 60 seconds to retrieve it",name _flagowner,_flagname],"PLAIN DOWN"]
?(isnull Flagowner FlagE) and _flagownerside==EAST:titletext[format["Hail the fallen HERO\n%1\n %2 is lying on his blood soaked corpse\n You have 60 seconds to retrieve it",name _flagowner,_flagname],"PLAIN DOWN"]
#deadloop
~1
_count = _count + 1
_flagowner=Flagowner _flag
?(Alive _Flagowner):goto "start"
?(_count == 60):goto "flagreturn"
goto "deadloop"

 
#start
~1
_flagowner=Flagowner _flag
?(isnull _flagowner):Goto "start"
 
?(Side _flagowner==WEST):_team="GI Joes"; _flagownerside=WEST
?(Side _flagowner==EAST):_team="NVA"; _flagownerside=EAST
?!(Alive _flagowner):Goto "DeadHasFlag"
 
#FlagTaken
 
titletext[format["That awesome Warrior dude\n%1\n has taken %2!",name _flagowner,_flagname],"PLAIN DOWN"]
PlaySound "FlagTake"
Goto "loop"

 
 
;;the loop continues to check for whether the flagcarrier is
;;dead, or has capped the flag.  Once either happens, the
;;flag is returned
 
#loop
~1
?(!Alive _flagowner):goto "DeadHasFlag"
?(isnull Flagowner FlagW) and _flagownerside==WEST and _flagowner distance FlagW<4:goto "WCaps"
?(isnull Flagowner FlagE) and _flagownerside==EAST and _flagowner distance FlagE<4:goto "ECaps"

 
Goto "loop"
 
;;this increments the score by 1 point for whichever team
;;caps the flag.  You can change the +1 to +5 or whatever
;;you want for a scoring method.  The ?(local Server)
;;makes sure the score is only incremented by the server
;;so that it remains accurate.
 
#WCaps
?Side Player == West:titletext[format["Awesome Warrior\n%1\n has capped\n %2!",name _flagowner,_flagname],"PLAIN DOWN"]
?Side Player == East:titletext[format["Thay dirty stinking scumbag\n%1\n has capped\n our flag",name _flagowner],"PLAIN DOWN"]
?(local Server):WScore=WScore+5; PublicVariable "WScore"
PlaySound "Capture"
Goto "ShowScore"
 
#ECaps

?Side Player == East:titletext[format["Awesome Warrior\n%1\n has capped\n %2!",name _flagowner,_flagname],"PLAIN DOWN"]
?Side Player == West:titletext[format["Thay dirty stinking scumbag\n%1\n has capped\n our flag",name _flagowner],"PLAIN DOWN"]
?(local Server):EScore=EScore+5; PublicVariable "EScore"
PlaySound "Capture"
Goto "ShowScore"
 

 
#ShowScore
?(local Server):ShowScore=true; PublicVariable "ShowScore"
 
Goto "FlagReturn"
 
 
#FlagReturn
?(_flag==FlagW):_flag SetFlagSide WEST
?(_flag==FlagE):_flag SetFlagSide EAST  
_flag setFlagOwner objNull
_flagreturnmsg=format["%1 \n has been returned",_flagname]
Hint _flagreturnmsg
 
Goto "start"
 
#end
Exit

This works fine

You will have to excuse the Vietnam flag, i copied this from a nam mission i am making


There is one slight error which i havent fixed yet (Just havent had time)
Sometimes when the following line is run

"titletext[format["Hail the fallen HERO\n%1\n %2 is lying on his blood soaked corpse\n You have 60 seconds to retrieve it",name _flagowner,_flagname],"PLAIN DOWN"]"

Instead of saying
"Hail the fallen hero
(Players Name)
the west flag is lying on his blood soaked corpse
You have 60 seconds to retrieve it"


It comes up with an error message where the players name should be

"Hail the fallen hero
(Error message here instead of players name)
the west flag is lying on his blood soaked corpse
You have 60 seconds to retrieve it"


However it doesnt stop the script from running and it only occasionally occurs
It simply just doesnt return the players name


The script is set up for a 60 second delay before the flag is returned
« Last Edit: 27 Jan 2003, 16:04:03 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Pope_Zog

  • Guest
Re:CTF Problem
« Reply #16 on: 27 Jan 2003, 16:46:56 »
LAPD, try calling this script when Trigger 4 is activated:

Code: [Select]
; Wait a few seconds before proceeding.
~4

; If the soldier was killed in the process of taking the flag, return it immediately.
? OwnerR distance Flag1 < 8 : goto "ReturnFlag"

; Wait for so many seconds before returning the flag.
~20

; If the flag has been taken by someone else, just exit.
? alive flagOwner Flag1 : exit

#ReturnFlag

Flag1 setFlagowner objNull;
OwnerR = objNull;
titletext ["The Flag return", "PLAIN DOWN"];
FlagTaken = False;
"0" objStatus "Active";

Pope Zog

Pope_Zog

  • Guest
Re:CTF Problem
« Reply #17 on: 27 Jan 2003, 16:54:24 »
Terox, the variable _flagowner hasn't been declared or used or set when you display the message. You can fix this by changing:

Quote
#DeadHasFlag
_count = 1
?(isnull Flagowner FlagW) and _flagownerside==WEST:titletext[format["Hail the fallen HERO\n%1\n %2 is lying on his blood soaked corpse\n You have 60 seconds to retrieve it",name _flagowner,_flagname],"PLAIN DOWN"]
etc.

to:

Quote
#DeadHasFlag
_flagowner=Flagowner _flag
_count = 1
?(isnull Flagowner FlagW) and _flagownerside==WEST:titletext[format["Hail the fallen HERO\n%1\n %2 is lying on his blood soaked corpse\n You have 60 seconds to retrieve it",name _flagowner,_flagname],"PLAIN DOWN"]

OR by changing name _flagowner to name (Flagowner _flag) where you display the messages.

Pope Zog
« Last Edit: 27 Jan 2003, 16:54:59 by Pope Zog »

LAPD

  • Guest
Re:CTF Problem
« Reply #18 on: 27 Jan 2003, 18:05:38 »
It dosen't work.  :(

The script is based that if the flag owner die in the area of the flag the flag will come back immediately, but as i said, it dosen't count that he took the flag until he actually finish doing the action of taking the flag. Well, it's not a big problem, since if a player comes to the area of the flag he can take the flag from the body just like from the flag pole.

Thanks anyway Pope Zog and Terox  :).

P.S:  I'll keep the topic open for Terox to reply to Pope Zog.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:CTF Problem
« Reply #19 on: 28 Jan 2003, 16:42:56 »
Thanks for fix Pope
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123