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

  1. //////////////////////////////////////////////////////////////////////////////
  2. // Hold the Black Flag rules common to holdflag and fusion
  3. //////////////////////////////////////////////////////////////////////////////
  4.  
  5. // in holdflag the black flag is a strategic item
  6. if startup1 then
  7.     deploy bkflagbase,
  8.     deploy blackflag1,
  9.     setitemflag blackflag1 strategic 1,
  10.     setitemflag blackflag1 stratsquare 1
  11.  
  12. // @1 = color, @2 = Capitalized color (e.g. "Green")
  13. macro holdflag_rules 2
  14. {
  15.     // these pairs of variables are used to prevent sarge dropping and picking up the flag
  16.     // within 1 second and scoring at a double rate
  17.     variable @1PickupFlagCount 0
  18.     variable @1KeepsFlagCheck 0
  19.  
  20.     // check for @1 sarge holding the flag
  21.  
  22.     if pickedup blackflag1 by @1sarge1 then
  23.         showmessage "@2 holds the flag",
  24.         playsound "mp_gotflag.wav" (0,0) 3 1,
  25.         addvar @1PickupFlagCount 1,
  26.         triggerdelay 3000 check@1holdsflag,
  27.         addscoresymbol @1 flag
  28.  
  29.     if dropped blackflag1 by @1sarge1 then
  30.         removescoresymbol @1 flag
  31.  
  32.     if check@1holdsflag then
  33.         addvar @1KeepsFlagCheck 1
  34.  
  35.     if check@1holdsflag testvar hasitem @1sarge1 blackflag1 = 1 then
  36.         trigger check@1scores
  37.  
  38.     if check@1scores testvar hasitem @1sarge1 blackflag1 = 1 and @1KeepsFlagCheck = @1PickupFlagCount then
  39.         addvar @1score holdFlagBonus,
  40.         playsound "mp_tick.wav" (0,0) 2 3,
  41.         trigger check@1wins,
  42.         triggerdelay 3000 check@1scores
  43. }
  44.  
  45. expand holdflag_rules ( green "Green" )
  46. expand holdflag_rules ( tan   "Tan" )
  47. expand holdflag_rules ( blue  "Blue" )
  48. expand holdflag_rules ( grey  "Grey" )
  49.  
  50. // if flag is dropped and not picked up for 2 minutes then return it to it's base
  51.  
  52. variable flagTimeOutVar 0
  53. variable flagLastTimeOutVar 1
  54.  
  55. if dropped blackflag1 then
  56.     triggerdelay 120000 flagCheckTimeOut
  57.  
  58. if pickedup blackflag1 then
  59.     addvar flagTimeOutVar 1
  60.  
  61. if flagCheckTimeOut testvar flagTimeOutVar = flagLastTimeOutVar then
  62.     showmessage "Black Flag was dropped and not picked up for 2 minutes - moved to base",
  63.     createexplosion blackflag1 128 0 green,
  64.     playsound "mp_rebaseflag.wav" (0,0) 2 1,
  65.     moveitem blackflag1 bkflagbase,
  66.     triggerdelay 1000 flagLastTimeOutIncr
  67.  
  68. if flagCheckTimeOut testvar flagTimeOutVar <> flagLastTimeOutVar then
  69.     triggerdelay 1000 flagLastTimeOutIncr
  70.  
  71. if flagLastTimeOutIncr then
  72.     addvar flagLastTimeOutVar 1
  73.