OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: SH@dow 113 on 20 Aug 2003, 16:33:12

Title: CTF script needed here
Post by: SH@dow 113 on 20 Aug 2003, 16:33:12
I can't get a CTF script to work would sombody pls send me one, alexisvandenbroeck@yahoo.com
Title: Re:CTF script needed here
Post by: Terox on 20 Aug 2003, 19:20:55
The following script is an edited version of the one i used for the EFL CTF Template
It's loosly based on a script that was available nearly 2 years ago but was bugged

It will need a bit of editing, I have only placed the script for the East flag,  doesnt take a miracle worker to edit for West flag

doesnt require any triggers, simply call the flag EFlag and WFlag
and in your init.sqs start the two scripts with the following lines

[] exec "WFlag.sqs"
[] exec "EFlag.sqs"

in the script below when the offencive team take a flag, the defencice team arent informed. Simply uncomment the lines if you want the defenders to know

you will have to add your own sound effects,  the sounds i used are called "Fanfare" and "Gong", simply replace these with the name of your own sound files

Quote
;;;;;;;; ________ DO NOT EDIT THIS SCRIPT ________ ;;;;;;;;
;;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"


#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
Title: Re:CTF script needed here
Post by: SH@dow 113 on 20 Aug 2003, 23:49:31
[shadow=red,left,300]Thx bro, i own u one[/shadow]  :thumbsup:
Title: Re:CTF script needed here
Post by: Terox on 21 Aug 2003, 02:07:16
the showscore bit, you will have to adapt to however u want the score top be displayed, hint box etc, i use something a bit different,  again, not difficult to improvise


forgot about that bit,  as this script is part of a mass of inter twining scripts
Title: Re:CTF script needed here
Post by: SickSidewinder on 27 Aug 2003, 01:57:14
could you give a better explaination on how to use the sound? do i have to make sound/music folders and declair them in the description.ext?  and how do i set the %1 variable for the flag return time?
Quote
["Our Flagrunner is dead\nWe have %1 seconds to retrieve it",FLAGRETURNDELAY],"PLAIN DOWN"]
im designing my first ctf mission (finally) and i need that kind of explanation.
maybe im just not reading it right.  I also added a sound for returnflag.
reading further again, how do i tell it to show the score?
do i adapt the lines you have above to display it on the screen?
i just need these things explained to me
Title: Re:CTF script needed here
Post by: SickSidewinder on 27 Aug 2003, 08:37:30
lol, i just didn't read close enough.  nm