home *** CD-ROM | disk | FTP | other *** search
/ Eigen PC: CD-ROM 37 / EPC_47.BIN / toyspace / data1.cab / Required_Files / rules / ctf_common.txt < prev    next >
Text File  |  1999-10-08  |  3KB  |  87 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. // Capture the flag rules common to ctf and ctf_death
  3. //////////////////////////////////////////////////////////////////////////////
  4.  
  5. // define the pads near each of the flag bases (used by AI)
  6.  
  7. pad neargreenbase 15 greensarge1
  8. pad neartanbase 16 tansarge1
  9. pad nearbluebase 17 bluesarge1
  10. pad neargreybase 18 greysarge1
  11.  
  12. // @1 = color, @2 = Capitalized color (e.g. "Green"),
  13. // @3 = other color, @4 = other color flagbase letter
  14. macro bringHomeEnemyFlag 4
  15. {
  16.     if padon @1base testvar hasitem @1sarge1 @3flag1 = 1 and isAlly @1 @3 = 0 then
  17.         showmessage "@2 scored with @3 flag",
  18.         trigger @1CapturedFlag,
  19.         dropitem @1sarge1 @3flag1 @4flagbase
  20. }
  21.  
  22. // playsounds if a flag is picked up by an enemy
  23. macro playPickupSound 2
  24. {
  25.     if pickedup @1flag1 by @2 testvar isAlly @1 @2 = 0 then
  26.         playsound "mp_got@1.wav" (0,0) 3 1
  27. }
  28.  
  29. // @1 = color, @2 = Capitalized color (e.g. "Green"), @3 = flagbase letter (e.g. 'g')
  30. // @4-6 are other colors, @7-8 are other colors flagbase letters
  31. macro ctfevents 9
  32. {
  33.     // deploy flags for colors in game and set the flags to strategic
  34.     if startup1 testvar iscoloringame @1 > 0 then
  35.         deploy @3flagbase,
  36.         deploy @1flag1 @3flagbase,
  37.         setitemflag @1flag1 strategic 1,
  38.         setitemflag @1flag1 stratsquare 1
  39.  
  40.     // check for a sarge bringing home an enemy flag
  41.     expand bringHomeEnemyFlag ( @1 "@2" @4 @7 )
  42.     expand bringHomeEnemyFlag ( @1 "@2" @5 @8 )
  43.     expand bringHomeEnemyFlag ( @1 "@2" @6 @9 )
  44.  
  45.     // update scores and show/play effects
  46.  
  47.     if @1CapturedFlag then
  48.         createexplosion @1base 137 0 @1,
  49.         playsound "mp_ctftobase.wav" (0,0) 1 2,
  50.         addvar @1score captureFlagBonus,
  51.         trigger check@1wins
  52.  
  53.     // if flag is dropped and not picked up for 2 minutes then return it to it's base
  54.  
  55.     variable @1FlagTimeOutVar 0
  56.     variable @1FlagLastTimeOutVar 1
  57.  
  58.     if dropped @1flag1 then
  59.         triggerdelay 120000 @1FlagCheckTimeOut
  60.  
  61.     if pickedup @1flag1 then
  62.         addvar @1FlagTimeOutVar 1
  63.  
  64.     if @1FlagCheckTimeOut testvar @1FlagTimeOutVar = @1FlagLastTimeOutVar then
  65.         showmessage "@2 Flag was dropped and not picked up for 2 minutes - moved to base",
  66.         createexplosion @1flag1 128 0 @1,
  67.         playsound "mp_rebaseflag.wav" (0,0) 2 1,
  68.         moveitem @1flag1 @3flagbase,
  69.         triggerdelay 1000 @1FlagLastTimeOutIncr
  70.  
  71.     if @1FlagCheckTimeOut testvar @1FlagTimeOutVar <> @1FlagLastTimeOutVar then
  72.         triggerdelay 1000 @1FlagLastTimeOutIncr
  73.  
  74.     if @1FlagLastTimeOutIncr then
  75.         addvar @1FlagLastTimeOutVar 1
  76.  
  77.     // playsounds if a flag is picked up by an enemy
  78.     expand playPickupSound ( @1 @4 )
  79.     expand playPickupSound ( @1 @5 )
  80.     expand playPickupSound ( @1 @6 )
  81. }
  82.  
  83. expand ctfevents ( green "Green" g tan blue grey t b gr )
  84. expand ctfevents ( tan "Tan" t green blue grey g b gr )
  85. expand ctfevents ( blue "Blue" b green tan grey g t gr )
  86. expand ctfevents ( grey "Grey" gr green tan blue g t b )
  87.