home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2003 June / macformat-130.iso / mac / Reviewed⁄Demos / Spearhead Demo / demota / pak1.pk3 / global / obj_capture.scr < prev    next >
Encoding:
Text File  |  2002-10-21  |  3.4 KB  |  141 lines

  1. //
  2. //
  3. //    LOGIC FOR King of The Hill/Capture and Hold ENTITIES
  4. //    by Z
  5. //
  6.  
  7. //***********************************************
  8. // initialization thread... 
  9. //***********************************************
  10.  
  11. flag_thinker:
  12.  
  13. //    level.flag_cap_time = 50  //tenths of a second
  14. //    level.flag_use_distance = 128 //quake units
  15. //    level.flagusefov = 30
  16.  
  17.     level.subtitleX = 300 // was 100
  18.     level.subtitleY = 460  // was 50
  19.  
  20.     println "----------------------Z-----------------------"
  21.     println "self = " self
  22.     println "----------------------Z-----------------------"
  23.     
  24.     level.allies_time = 0
  25.     level.axis_time = 0
  26.     
  27.     self.axis_flag hide
  28.     self.axis_flag notsolid
  29.     self.allies_flag hide
  30.     self.allies_flag notsolid
  31.     self.neutral_flag show
  32.     self.neutral_flag solid
  33.  
  34.     self.controlling_team = "neutral"
  35.     level.dmroundlimit = 12
  36.     level.win_time = 300
  37.  
  38.     thread flag_waittill_capture
  39.     thread flag_add_points
  40. end
  41.  
  42. //***********************************************
  43. // change who currently controls the flag
  44. //***********************************************
  45.  
  46.  
  47. flag_waittill_capture:
  48.  
  49.     while ( $(self) )
  50.     {
  51.         println "waittill trigger " self
  52.         self waittill trigger
  53.  
  54.         local.player = parm.other
  55.         //"local.player.dmteam", can be 'spectator', 'freeforall', 'allies' or 'axis'
  56.  
  57.             if (local.player.dmteam == self.controlling_team) 
  58.         {
  59.             println "failed same team as flag check" local.player.dmteam
  60.             goto flag_waittill_capture    
  61.         }    
  62.     
  63.  
  64.         if (local.player.dmteam == "allies")
  65.         {
  66.             iprintlnbold "The Flag has been captured by the Allies!"
  67.             self playsound dfr_objective_o
  68.             self.controlling_team = local.player.dmteam
  69.             self.axis_flag hide
  70.             self.allies_flag show
  71.             self.neutral_flag hide
  72.         }
  73.         else
  74.         {
  75.             iprintlnbold "The Flag has been captured by the Axis!"
  76.             self playsound den_objective_o
  77.             self.controlling_team = local.player.dmteam
  78.             self.axis_flag show
  79.             self.allies_flag hide
  80.             self.neutral_flag hide
  81.         }
  82.         waitframe
  83.     }
  84. end
  85.  
  86.  
  87.  
  88. //***********************************************
  89. // set who is currently winning, accumulate points
  90. //***********************************************
  91.  
  92.  
  93. flag_add_points:
  94.  
  95. while ( $(self))
  96. {
  97.     if (self.controlling_team == "neutral")
  98.     {
  99.         level.clockside = draw // set to axis, allies, kills, or draw
  100.     }
  101.     else
  102.     if (self.controlling_team == "allies")
  103.     {
  104.         level.allies_time ++
  105.         if (level.allies_time > level.axis_time)
  106.             level.clockside = allies // set to axis, allies, kills, or draw
  107.  
  108.     }
  109.     else
  110.     if (self.controlling_team == "axis")
  111.     {
  112.         level.axis_time ++
  113.         if (level.axis_time > level.allies_time)
  114.             level.clockside = axis // set to axis, allies, kills, or draw
  115.     }
  116.     
  117.     if (level.axis_time >= level.win_time)
  118.     {
  119.         teamwin axis
  120.     }
  121.     if (level.allies_time >= level.win_time)
  122.     {
  123.         teamwin allies
  124.     }
  125.  
  126.     if (self.controlling_team == "axis")
  127.     {
  128.         locprint level.subtitleX level.subtitleY ("Axis Time: "+ level.axis_time + "\n" + "Allies Time: "+ level.allies_time + "\n" + "Win Time: "+ level.win_time)
  129. //        locprint level.subtitleX (level.subtitleY + 10) ()
  130.     }
  131.     else
  132.     {
  133.         locprint level.subtitleX level.subtitleY ("Allies Time: "+ level.allies_time + "\n" + "Axis Time: "+ level.axis_time + "\n" + "Win Time: "+ level.win_time)
  134. //        locprint level.subtitleX (level.subtitleY + 10) ("Axis Time: "+ level.axis_time)
  135.     }    
  136.     //locprint level.subtitleX (level.subtitleY + 20) ()
  137.         
  138.     
  139.     wait 1
  140. }
  141. end