////////////////////////////////////////////////////////////////////////////// // Capture the flag rules common to ctf and ctf_death ////////////////////////////////////////////////////////////////////////////// // define the pads near each of the flag bases (used by AI) pad neargreenbase 15 greensarge1 pad neartanbase 16 tansarge1 pad nearbluebase 17 bluesarge1 pad neargreybase 18 greysarge1 // @1 = color, @2 = Capitalized color (e.g. "Green"), // @3 = other color, @4 = other color flagbase letter macro bringHomeEnemyFlag 4 { if padon @1base testvar hasitem @1sarge1 @3flag1 = 1 and isAlly @1 @3 = 0 then showmessage "@2 scored with @3 flag", trigger @1CapturedFlag, dropitem @1sarge1 @3flag1 @4flagbase } // playsounds if a flag is picked up by an enemy macro playPickupSound 2 { if pickedup @1flag1 by @2 testvar isAlly @1 @2 = 0 then playsound "mp_got@1.wav" (0,0) 3 1 } // @1 = color, @2 = Capitalized color (e.g. "Green"), @3 = flagbase letter (e.g. 'g') // @4-6 are other colors, @7-8 are other colors flagbase letters macro ctfevents 9 { // deploy flags for colors in game and set the flags to strategic if startup1 testvar iscoloringame @1 > 0 then deploy @3flagbase, deploy @1flag1 @3flagbase, setitemflag @1flag1 strategic 1, setitemflag @1flag1 stratsquare 1 // check for a sarge bringing home an enemy flag expand bringHomeEnemyFlag ( @1 "@2" @4 @7 ) expand bringHomeEnemyFlag ( @1 "@2" @5 @8 ) expand bringHomeEnemyFlag ( @1 "@2" @6 @9 ) // update scores and show/play effects if @1CapturedFlag then createexplosion @1base 137 0 @1, playsound "mp_ctftobase.wav" (0,0) 1 2, addvar @1score captureFlagBonus, trigger check@1wins // if flag is dropped and not picked up for 2 minutes then return it to it's base variable @1FlagTimeOutVar 0 variable @1FlagLastTimeOutVar 1 if dropped @1flag1 then triggerdelay 120000 @1FlagCheckTimeOut if pickedup @1flag1 then addvar @1FlagTimeOutVar 1 if @1FlagCheckTimeOut testvar @1FlagTimeOutVar = @1FlagLastTimeOutVar then showmessage "@2 Flag was dropped and not picked up for 2 minutes - moved to base", createexplosion @1flag1 128 0 @1, playsound "mp_rebaseflag.wav" (0,0) 2 1, moveitem @1flag1 @3flagbase, triggerdelay 1000 @1FlagLastTimeOutIncr if @1FlagCheckTimeOut testvar @1FlagTimeOutVar <> @1FlagLastTimeOutVar then triggerdelay 1000 @1FlagLastTimeOutIncr if @1FlagLastTimeOutIncr then addvar @1FlagLastTimeOutVar 1 // playsounds if a flag is picked up by an enemy expand playPickupSound ( @1 @4 ) expand playPickupSound ( @1 @5 ) expand playPickupSound ( @1 @6 ) } expand ctfevents ( green "Green" g tan blue grey t b gr ) expand ctfevents ( tan "Tan" t green blue grey g b gr ) expand ctfevents ( blue "Blue" b green tan grey g t gr ) expand ctfevents ( grey "Grey" gr green tan blue g t b )