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

  1. //------
  2. // Patrol
  3. //------
  4. // This is just a copy of the walk script. It needs to be altered to provide proper
  5. // patrolling behaviour, like looking around and stuff.
  6.  
  7. //println "patrol.scr"
  8.  
  9.  
  10. //===================================================================================
  11. PatrolMain:
  12.  
  13.     waitexec anim/default_inithandler.scr
  14.     waitexec anim/smoking.scr::SmokeCigaretteInit
  15.  
  16.     while (1)
  17.     {
  18.         waitexec anim/smoking.scr::SmokeCigarette
  19.         
  20.         /////waitthread anim/patrol.scr::PatrolWalkOneCycle
  21.  
  22.         // Patrol 3-6 cycles so we don't smoke every second.
  23.         local.numcycles = (randomint 4) + 3
  24.         for (local.i=0 ; local.i < local.numcycles ; local.i += 1)
  25.         {
  26.             waitexec anim/patrol.scr::PatrolWalkOneCycle
  27.         }
  28.     }
  29.  
  30. end
  31.  
  32.  
  33. //===================================================================================
  34. PatrolWalkOneCycle:
  35.     self.blendtime = 0.5
  36.     if (self.ground == water)
  37.     {
  38.         self setmotionanim walk_rifle_water
  39.         self waittill flaggedanimdone
  40.     }
  41.     else if (self.normal_health < 60)
  42.     {
  43.         //self setmotionanim walk_injured
  44.         //self waittill flaggedanimdone
  45.         if (self.movedir != (0 0 0))
  46.         {
  47.             //println "Patrol.scr using injured motion blend with movedir: " self.movedir
  48.             local.stepdonetime = level.time + 2    // Let's arbitrarily decide that a step is two seconds.
  49.             while (level.time < local.stepdonetime)
  50.             {
  51.                 waitexec anim/motionblend.scr::PlayAnim "walk_injured_"
  52.             }
  53.         }
  54.         else
  55.         {
  56.             //println "Patrol.scr with **NO** motion blend"
  57.             self setmotionanim walk_injured_forward
  58.             self waittill flaggedanimdone
  59.         }
  60.     }
  61.     else
  62.     {
  63.         //println "Default walk - walk with gun down"
  64.         //self setmotionanim (self.weapongroup + "_walk_patrol_forward") 
  65.         
  66.         if (self.movedir != (0 0 0))
  67.         {
  68.             //println "Patrol.scr using motion blend with movedir: " self.movedir
  69.             // motionblend.scr only lasts 0.2 seconds!  We can't treat one execution of that as a full step!
  70.             //waitexec anim/motionblend.scr::PlayAnim (self.weapongroup + "_walk_patrol_")
  71.             local.stepdonetime = level.time + 2    // Let's arbitrarily decide that a step is two seconds.
  72.             while (level.time < local.stepdonetime)
  73.             {
  74.                 waitexec anim/motionblend.scr::PlayAnim (self.weapongroup + "_walk_patrol_")
  75.             }
  76.         }
  77.         else
  78.         {
  79.             //println "Patrol.scr with **NO** motion blend"
  80.             self setmotionanim (self.weapongroup + "_walk_patrol_forward")
  81.             self waittill flaggedanimdone
  82.         }
  83.     }
  84.     self.position = walk
  85. end
  86.