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

  1. start local.sci1 local.sci2 local.board:
  2.  
  3. println "Entered scientist_wallchart.scr"
  4.  
  5.  
  6.  
  7. if (local.board != NIL)
  8. {
  9.     println "Moving scientists to board"
  10.     group.forwardvector = local.board.forwardvector
  11.  
  12.     // Figure out which scientist is on the left
  13.     if ( (vector_dot local.sci1 local.board.leftvector) > (vector_dot local.sci2 local.board.leftvector) )
  14.     {
  15.         group.scientist1 = local.sci1
  16.         group.scientist2 = local.sci2
  17.     }
  18.     else
  19.     {
  20.         group.scientist1 = local.sci2
  21.         group.scientist2 = local.sci1
  22.     }
  23.                //group.scientist1 exec global/disable_ai.scr
  24.                //group.scientist2 exec global/disable_ai.scr
  25.             //    println group.forwardvector
  26.     group.originleft = local.board.origin + (group.forwardvector*24) - (local.board.leftvector*22.6)
  27.     group.originright = local.board.origin + (group.forwardvector*27.4) + (local.board.leftvector*22.6)
  28.  
  29.     group.donemarker = 0
  30.     thread sci1walkto group.originright
  31.     thread sci2walkto group.originleft 
  32. }
  33. else
  34. {
  35.     println "Leaving scientists in place"
  36.     group.originright = local.sci1.origin
  37.     group.originleft = local.sci2.origin
  38.     group.forwardvector = local.sci1.forwardvector * -1
  39.     group.scientist1 = local.sci1
  40.     group.scientist2 = local.sci2
  41.     thread depressed
  42. }
  43.  
  44. end
  45.  
  46. //-----------inposition-----------
  47. // Moves either or both scientists into the position they need to be in.  Returns 1 if they are ok.
  48. inposition:
  49.  
  50. if ( ( vector_length(group.scientist1.origin - group.originright) > 8 ) || ( vector_length(group.scientist2.origin - group.originleft) > 8 ) )
  51. {
  52.     println "Moving scientists to board"
  53.     group.donemarker = 0
  54.     thread sci1walkto group.originright
  55.     thread sci2walkto group.originleft
  56.     end 0
  57. }
  58. else 
  59. {
  60.     group.scientist1.origin = group.originright
  61.     group.scientist2.origin = group.originleft
  62.     end 1
  63. }
  64. end    // Not necessary, but easier to read
  65.  
  66. //-----------sci1walkto------------
  67. sci1walkto local.pos:
  68.  
  69.                //thread walklook ( local.pos - group.forwardvector ) group.scientist2
  70.                //local.lookthread = parm.previousthread
  71.  
  72. group.scientist1 exec global/walkto.scr local.pos
  73. group.scientist1 waittill movedone
  74.             //group.scientist1 turnto (group.scientist1.origin - group.forwardvector )
  75. group.scientist1.origin = local.pos
  76.             //local.lookthread end
  77. if (group.donemarker > 0)
  78. {
  79.     thread depressed
  80. }
  81. else
  82. {
  83.             //    group.scientist1 lookat group.scientist2    // Look at partner
  84.     group.scientist1 anim "scientist_wallchart_depressed_sci1"
  85.     group.donemarker = 1
  86. }
  87. end
  88.  
  89. //-----------sci2walkto------------
  90. sci2walkto local.pos:
  91.  
  92.                //thread walklook ( local.pos - group.forwardvector ) group.scientist1
  93.                //local.lookthread = parm.previousthread
  94.  
  95. group.scientist2 exec global/walkto.scr local.pos
  96. group.scientist2 waittill movedone
  97.             //group.scientist2 turnto (group.scientist2.origin - group.forwardvector )
  98. group.scientist2.origin = local.pos
  99.             //local.lookthread end
  100. if (group.donemarker > 0)
  101. {
  102.     thread depressed
  103. }
  104. else
  105. {
  106.                //    group.scientist2 lookat group.scientist2    // Look straight ahead
  107.     group.scientist2 anim "scientist_wallchart_depressed_sci2"
  108.     group.donemarker = 1
  109. }
  110. end
  111.  
  112. //------------walklook--------------
  113. walklook local.destination local.other:
  114.                //while (1)
  115.                //{
  116.                //    group.scientist2 lookat local.destination
  117.                //    wait 0.5
  118.                //    group.scientist2 lookat group.other
  119.                //    wait 0.5
  120.                //    group.scientist2 lookat $player
  121.                //    wait 0.5
  122.                //}
  123.                
  124.                //-----------depressed------------
  125. depressed:
  126.  
  127.                //println "Entered scientist_wallchart.scr::depressed"
  128.                
  129.                // Check position
  130.                //if ( !(thread inposition) ) end
  131.                
  132.                // Look straight ahead and turn to the board
  133.                //group.scientist1 lookat group.scientist1
  134.                //group.scientist2 lookat group.scientist2
  135. group.scientist1 turnto (group.scientist1.origin - group.forwardvector )
  136. group.scientist2 turnto (group.scientist2.origin - group.forwardvector )
  137.  
  138.  
  139. group.scientist1 anim "scientist_wallchart_depressed_sci1"
  140. group.scientist2 anim "scientist_wallchart_depressed_sci2"
  141.  
  142.                //local.randnum = (randomint 200) + 300
  143.                //wait ( local.randnum / 100 )
  144.  
  145. group.scientist1 turnto (group.scientist1.origin - group.forwardvector )
  146. group.scientist2 turnto (group.scientist2.origin - group.forwardvector )
  147. group.scientist1 anim "scientist_wallchart_depressedtoidle_sci1"
  148. group.scientist2 anim "scientist_wallchart_depressedtoidle_sci2"
  149. group.scientist1 waittill animdone
  150.  
  151. local.randnum = randomint (100)
  152.  
  153. if        (local.randnum < 30)    thread idle1
  154. else if    (local.randnum < 60)    thread idle2
  155. else if    (local.randnum < 90)    thread idle3
  156. else                        thread idletodepressed
  157.  
  158. end
  159.  
  160. //-----------idle1------------
  161. idle1:
  162.  
  163.             //println "Entered scientist_wallchart.scr::idle1"
  164.  
  165.                // Check position
  166.                //if ( !(thread inposition) ) end
  167.  
  168. group.scientist1 turnto (group.scientist1.origin - group.forwardvector )
  169. group.scientist2 turnto (group.scientist2.origin - group.forwardvector )
  170.  
  171. group.scientist1 anim "scientist_wallchart_idle1_sci1"
  172. group.scientist2 anim "scientist_wallchart_idle1_sci2"    
  173. group.scientist1 waittill animdone
  174.  
  175. local.randnum = randomint (100)
  176. if        (local.randnum < 10)    thread idle1
  177. else if    (local.randnum < 50)    thread idle2
  178. else if    (local.randnum < 90)    thread idle3
  179. else                        thread idletodepressed
  180.  
  181. end
  182.  
  183. //-----------idle2------------
  184. idle2:
  185.  
  186.                //println "Entered scientist_wallchart.scr::idle2"
  187.                
  188.                // Check position
  189.                //if ( !(thread inposition) ) end
  190.  
  191. group.scientist1 turnto (group.scientist1.origin - group.forwardvector )
  192. group.scientist2 turnto (group.scientist2.origin - group.forwardvector )
  193. group.scientist1 anim "scientist_wallchart_idle2_sci1"
  194. group.scientist2 anim "scientist_wallchart_idle2_sci2"    
  195. group.scientist1 waittill animdone
  196.  
  197. local.randnum = randomint (100)
  198. if        (local.randnum < 40)    thread idle1
  199. else if    (local.randnum < 50)    thread idle2
  200. else if    (local.randnum < 90)    thread idle3
  201. else                        thread idletodepressed
  202.  
  203. end
  204.  
  205. //-----------idle3------------
  206. idle3:
  207.  
  208.                //println "Entered scientist_wallchart.scr::idle3"
  209.                
  210.                // Check position
  211.                //if ( !(thread inposition) ) end
  212.  
  213. group.scientist1 turnto (group.scientist1.origin - group.forwardvector )
  214. group.scientist2 turnto (group.scientist2.origin - group.forwardvector )
  215. group.scientist1 anim "scientist_wallchart_idle3_sci1"
  216. group.scientist2 anim "scientist_wallchart_idle3_sci2"    
  217. group.scientist1 waittill animdone
  218.  
  219. local.randnum = randomint (100)
  220. if        (local.randnum < 35)    thread idle1
  221. else if    (local.randnum < 70)    thread idle2
  222. else if    (local.randnum < 80)    thread idle3
  223. else                        thread idletodepressed
  224.  
  225. end
  226.  
  227.  
  228. //-----------idletodepressed------------
  229. idletodepressed:
  230.  
  231.                //println "Entered scientist_wallchart.scr::idletodepressed"
  232.                
  233.                // Check position
  234.                //if ( !(thread inposition) ) end
  235.                
  236.                //group.scientist1 turnto (group.scientist1.origin - group.forwardvector )
  237.                //group.scientist2 turnto (group.scientist2.origin - group.forwardvector )
  238. group.scientist1 turnto (group.scientist1.origin - group.forwardvector )
  239. group.scientist2 turnto (group.scientist2.origin - group.forwardvector )
  240. group.scientist1 anim "scientist_wallchart_idletodepressed_sci1"
  241. group.scientist2 anim "scientist_wallchart_idletodepressed_sci2"        
  242. group.scientist1 waittill animdone
  243. thread depressed
  244. end
  245.  
  246.  
  247.