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

  1. // tells AI to aim and then shoot if seen and keep shooting
  2. // can give the AI two targets. it will shoot at one until its dead then shoot at the next one.
  3. //defaults to 8 shots 
  4.  
  5. start local.target local.target2 local.reload:
  6. local.time_between_shots = .2
  7. if (local.reload == NIL)
  8. {
  9. local.reload = 8
  10. }
  11. //println "local reload" 
  12. //println local.reload
  13. local.i = 0
  14.  
  15. while (local.target.health != 0 && local.target != NULL)
  16. {
  17. self exec global/aimat.scr local.target.origin
  18. wait .1
  19. if (self cansee local.target) 
  20. {
  21. self exec global/shoot.scr
  22. //println "shot number: " local.i
  23. local.i ++
  24.  
  25. if (local.i == local.reload)
  26.     {
  27.     //println "reloading"
  28.     wait 3
  29.     local.i = 0
  30.     }
  31. }
  32. wait local.time_between_shots
  33. }
  34.  
  35. if(local.target2 == NIL)
  36. {
  37. end
  38. }
  39.  
  40. while (local.target2.health != 0 && local.target2 != NULL)
  41. {
  42. self exec global/aimat.scr local.target2.origin
  43. wait .1
  44. if (self cansee local.target) 
  45. {
  46. self exec global/shoot.scr
  47. local.i ++
  48. if (local.i == local.reload)
  49.     {
  50.     wait 3
  51.     local.i = 0
  52.     }
  53. }
  54. wait local.time_between_shots
  55. }
  56. end