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

  1. //-----------------------------------------------------------------
  2. // dialog_to.scr
  3. //
  4. //
  5. //        modified version of say_to.scr which allows you to pass
  6. //    either the local.sound, local.anim, or both.
  7. //
  8. //-----------------------------------------------------------------
  9.  
  10.  
  11. //-----------------------------------------------------------------
  12. dialog local.sound local.anim local.listener local.distance local.movecloser:
  13. //
  14. //    
  15. //-----------------------------------------------------------------
  16.     if (self == NULL)
  17.     {
  18.         println "Z:        null speaker: " self " " local.alias
  19.         end
  20.     }
  21.     
  22.     if (local.listener == NULL)
  23.     {
  24.         local.movecloser = 0
  25.     }
  26.  
  27.     if ( local.listener!=NULL && local.listener!=NIL )
  28.     {
  29.         if (local.distance == NIL || local.distance < 64)
  30.             local.distance = 160
  31.         if (local.movecloser != 1)
  32.         {
  33.             local.save = self.friendtype
  34.             self.friendtype = -1
  35.             
  36.             while (((vector_length(local.listener.origin - self.origin)) > local.distance) || !(local.listener cansee self))
  37.             {
  38.             
  39.             if ((vector_length(local.listener.origin - self.origin)) > local.distance)
  40.                 println "Z:        speaker too far from listener: " local.listener
  41.             if !(local.listener cansee self)
  42.                 println "Z:        speaker cant see listener: " local.listener
  43.             
  44.             self exec global/runto.scr local.listener.origin
  45.             wait .2
  46.             }
  47.         //    self exec global/stand.scr
  48.             
  49.             self.friendtype = local.save
  50.         }
  51.     }
  52.  
  53.     self turnto local.listener
  54.     self lookat local.listener
  55.     wait .3
  56.  
  57.     if ( local.sound!=NIL && local.sound!=NULL )
  58.         self say local.sound
  59.  
  60.     if ( local.anim!=NIL && local.anim!=NULL )
  61.     {
  62.         self anim local.anim
  63.         self waittill animdone
  64.     }
  65.     else
  66.     {
  67.         if ( local.sound!=NIL && local.sound!=NULL )
  68.             self waittill saydone
  69.     }
  70.  
  71.     self turnto NULL
  72.     self lookat NULL
  73.  
  74.     End
  75.  
  76.