home *** CD-ROM | disk | FTP | other *** search
/ Hráč 1998 July & August / Hrac_23_1998-07-08_cd2.bin / Demos / Sin / setup.exe / DATA / base / Pak0.pak / global / friend.scr < prev    next >
Text File  |  1998-07-26  |  6KB  |  259 lines

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