home *** CD-ROM | disk | FTP | other *** search
/ Hacker 9 / HACKER09.ISO / Games / Sin.exe / DATA / base / Pak0.pak / global / enemy.scr next >
Text File  |  1998-07-26  |  7KB  |  275 lines

  1. //
  2. // enemy.scr
  3. //
  4. // This file is parsed by actors.  It sets up the AI states.
  5. //
  6.  
  7. pause
  8. !init:
  9.  
  10. local.self enemy
  11. local.self ignoreall
  12. local.self respondto act_idle                    idle
  13. local.paranoia = 0
  14. local.self state act_idle
  15.  
  16. end
  17.  
  18.  
  19. //************************************************************
  20. //
  21. // idle:
  22. // Alert, but standing around waiting for action.
  23. //
  24. //************************************************************
  25.  
  26. idle:
  27.  
  28. local.self clearstate
  29.  
  30. local.self respondto act_pain                    pain
  31.  
  32. local.self respondto act_opendoor            opendoor
  33.  
  34. local.self respondto act_activated            attackentity
  35. local.self respondto act_used                    attackentity
  36.  
  37. local.self respondto act_sightenemy            sightenemy
  38. local.self respondto act_weaponsound        runtoarea
  39. local.self respondto act_movementsound        investigate
  40. local.self respondto act_painsound            investigate
  41. local.self respondto act_deathsound            runtoarea
  42. local.self respondto act_breakingsound        runtoarea
  43. local.self respondto act_doorsound            investigate
  44. local.self respondto act_mutantsound        runtoarea
  45. local.self respondto act_voicesound            investigate
  46. local.self respondto act_machinesound        idle
  47. local.self respondto act_radiosound            investigate
  48.  
  49. local.self respondto act_runtoarea            runtoarea
  50. // local.self respondto act_idle                    idle
  51. local.self respondto act_twitch                twitch
  52. local.self respondto act_stop                    idle
  53.  
  54. local.self ignore        act_nearfriend
  55. local.self ignore        act_range_melee    act_range_near        act_range_med        act_range_far
  56. local.self ignore        act_health_danger    act_health_low        act_health_med        act_health_ok
  57.  
  58. idle_loop:
  59.  
  60. local.self idle "idle"
  61. waitFor local.self
  62. goto idle_loop
  63.  
  64. end
  65.  
  66. //************************************************************
  67. //
  68. // pain:
  69. // Called when actor damaged
  70. //
  71. //************************************************************
  72.  
  73. pain:
  74.  
  75. // ignore most messages
  76. local.self ignore act_pain    act_opendoor attackentity act_used act_sightenemy
  77. local.self ignore act_weaponsound act_movementsound act_painsound act_deathsound act_breakingsound
  78. local.self ignore act_doorsound act_mutantsound act_voicesound act_machinesound act_radiosound
  79. local.self ignore act_runtoarea act_twitch act_stop
  80.  
  81. local.self anim local.painanim
  82. waitFor local.self
  83.  
  84. end
  85.  
  86. //************************************************************
  87. //
  88. // opendoor:
  89. // Called when actor blocked by door
  90. //
  91. //************************************************************
  92.  
  93. opendoor:
  94.  
  95. local.self behavior OpenDoor local.dir
  96. waitFor local.self
  97.  
  98. end
  99.  
  100. //************************************************************
  101. //
  102. // twitch:
  103. // Called periodically by idle command
  104. //
  105. //************************************************************
  106.  
  107. twitch:
  108.  
  109. // Twitching "relaxes" the actor
  110. local.paranoia -= 5
  111. local.paranoia ifless 0 local.paranoia = 0
  112.  
  113. local.self anim "twitch"
  114. waitFor local.self
  115.  
  116. end
  117.  
  118. //************************************************************
  119. //
  120. // attackentity:
  121. // Called when actor is activated or used.
  122. //
  123. //************************************************************
  124.  
  125. attackentity:
  126.  
  127. local.self clearstate
  128.  
  129. // ignore future triggerings
  130. local.self ignore act_activated act_used
  131. local.self attack local.other
  132. waitFor local.self
  133.  
  134. local.self state act_idle
  135.  
  136. end
  137.  
  138. //************************************************************
  139. //
  140. // investigate:
  141. // Actor walks to location and fights enemies along the way.
  142. // If really paranoid, runs to location.
  143. //
  144. //************************************************************
  145.  
  146. investigate:
  147.  
  148. local.self clearstate
  149.  
  150. // increase his paranoia
  151. local.paranoia += 3
  152.  
  153. // walk over, unless really paranoid, in which case run!
  154. parm.anim string "walk"
  155. local.paranoia ifgreater 10 parm.anim string "run"
  156. local.self behavior Investigate parm.anim local.location
  157. waitFor local.self
  158.  
  159. // stand around for a bit
  160. local.self anim idle
  161. waitFor local.self
  162. wait 5
  163.  
  164. parm.yaw = local.yaw
  165. parm.yaw += 60
  166. local.self turnto parm.yaw
  167. wait 5
  168.  
  169. parm.yaw = local.yaw
  170. parm.yaw += 60
  171. local.self turnto parm.yaw
  172. wait 5
  173.  
  174. // Hmmm, didn't see anything.  Must have been nothing.
  175. // Go back to where we started
  176. local.self walkto local.startpos
  177. waitFor local.self
  178.  
  179. local.self state act_idle
  180. end
  181.  
  182. //************************************************************
  183. //
  184. // runtoarea:
  185. // Actor runs to location and fights enemies along the way
  186. //
  187. //************************************************************
  188.  
  189. runtoarea:
  190.  
  191. local.self clearstate
  192.  
  193. // increase his paranoia a bit (gunshots usually come in large quantities)
  194. local.paranoia += 2
  195.  
  196. // run over there
  197. local.self behavior Investigate "run" local.location
  198. waitFor local.self
  199.  
  200. // stand around for a bit
  201. local.self anim idle
  202. waitFor local.self
  203. wait 5
  204.  
  205. parm.yaw = local.yaw
  206. parm.yaw += 120
  207. local.self turnto parm.yaw
  208. wait 5
  209.  
  210. parm.yaw = local.yaw
  211. parm.yaw += 120
  212. local.self turnto parm.yaw
  213. wait 5
  214.  
  215. // Hmmm, didn't see anything.  Must have been nothing.
  216. // Go back to where we started
  217. local.self walkto local.startpos
  218. waitFor local.self
  219.  
  220. local.self state act_idle
  221. end
  222.  
  223. //************************************************************
  224. //
  225. // sightenemy:
  226. // Actor sees an enemy for the first time
  227. //
  228. //************************************************************
  229.  
  230. sightenemy:
  231.  
  232. local.self clearstate
  233.  
  234. // crank up his paranoia level
  235. local.paranoia += 20
  236.  
  237. goto fireundercover
  238.  
  239. //************************************************************
  240. //
  241. // fireundercover:
  242. // Actor searches for enemy and uses cover
  243. //
  244. //************************************************************
  245.  
  246. fireundercover:
  247.  
  248. local.self clearstate
  249.  
  250. local.self respondto act_runtoarea            runtoarea
  251. local.self respondto act_twitch                twitch
  252. local.self respondto act_stop                    idle
  253.  
  254. local.self ignore act_activated                act_used                    act_sightenemy        act_nearfriend
  255. local.self ignore act_weaponsound            act_movementsound        act_painsound        act_deathsound        act_breakingsound 
  256. local.self ignore act_doorsound                act_mutantsound        act_voicesound        act_machinesound    act_radiosound 
  257.  
  258. local.self respondto act_range_melee        ""
  259. local.self respondto act_range_near            ""
  260. local.self respondto act_range_med            ""
  261. local.self respondto act_range_far            ""
  262.  
  263. local.self respondto act_health_danger        ""
  264. local.self respondto act_health_low            ""
  265. local.self respondto act_health_med            ""
  266. local.self respondto act_health_ok            ""
  267.  
  268. fireundercoverloop:
  269.  
  270. local.self behavior FireFromCover "run"
  271. waitFor local.self
  272.  
  273. goto fireundercoverloop
  274. end
  275.