home *** CD-ROM | disk | FTP | other *** search
- //
- // enemy.scr
- //
- // This file is parsed by actors. It sets up the AI states.
- //
-
- pause
- !init:
-
- local.self enemy
- local.self ignoreall
- local.self respondto act_idle idle
- local.paranoia = 0
- local.self state act_idle
-
- end
-
-
- //************************************************************
- //
- // idle:
- // Alert, but standing around waiting for action.
- //
- //************************************************************
-
- idle:
-
- local.self clearstate
-
- local.self respondto act_pain pain
-
- local.self respondto act_opendoor opendoor
-
- local.self respondto act_activated attackentity
- local.self respondto act_used attackentity
-
- local.self respondto act_sightenemy sightenemy
- local.self respondto act_weaponsound runtoarea
- local.self respondto act_movementsound investigate
- local.self respondto act_painsound investigate
- local.self respondto act_deathsound runtoarea
- local.self respondto act_breakingsound runtoarea
- local.self respondto act_doorsound investigate
- local.self respondto act_mutantsound runtoarea
- local.self respondto act_voicesound investigate
- local.self respondto act_machinesound idle
- local.self respondto act_radiosound investigate
-
- local.self respondto act_runtoarea runtoarea
- // local.self respondto act_idle idle
- local.self respondto act_twitch twitch
- local.self respondto act_stop idle
-
- local.self ignore act_nearfriend
- local.self ignore act_range_melee act_range_near act_range_med act_range_far
- local.self ignore act_health_danger act_health_low act_health_med act_health_ok
-
- idle_loop:
-
- local.self idle "idle"
- waitFor local.self
- goto idle_loop
-
- end
-
- //************************************************************
- //
- // pain:
- // Called when actor damaged
- //
- //************************************************************
-
- pain:
-
- // ignore most messages
- local.self ignore act_pain act_opendoor attackentity act_used act_sightenemy
- local.self ignore act_weaponsound act_movementsound act_painsound act_deathsound act_breakingsound
- local.self ignore act_doorsound act_mutantsound act_voicesound act_machinesound act_radiosound
- local.self ignore act_runtoarea act_twitch act_stop
-
- local.self anim local.painanim
- waitFor local.self
-
- end
-
- //************************************************************
- //
- // opendoor:
- // Called when actor blocked by door
- //
- //************************************************************
-
- opendoor:
-
- local.self behavior OpenDoor local.dir
- waitFor local.self
-
- end
-
- //************************************************************
- //
- // twitch:
- // Called periodically by idle command
- //
- //************************************************************
-
- twitch:
-
- // Twitching "relaxes" the actor
- local.paranoia -= 5
- local.paranoia ifless 0 local.paranoia = 0
-
- local.self anim "twitch"
- waitFor local.self
-
- end
-
- //************************************************************
- //
- // attackentity:
- // Called when actor is activated or used.
- //
- //************************************************************
-
- attackentity:
-
- local.self clearstate
-
- // ignore future triggerings
- local.self ignore act_activated act_used
- local.self attack local.other
- waitFor local.self
-
- local.self state act_idle
-
- end
-
- //************************************************************
- //
- // investigate:
- // Actor walks to location and fights enemies along the way.
- // If really paranoid, runs to location.
- //
- //************************************************************
-
- investigate:
-
- local.self clearstate
-
- // increase his paranoia
- local.paranoia += 3
-
- // walk over, unless really paranoid, in which case run!
- parm.anim string "walk"
- local.paranoia ifgreater 10 parm.anim string "run"
- local.self behavior Investigate parm.anim local.location
- waitFor local.self
-
- // stand around for a bit
- local.self anim idle
- waitFor local.self
- wait 5
-
- parm.yaw = local.yaw
- parm.yaw += 60
- local.self turnto parm.yaw
- wait 5
-
- parm.yaw = local.yaw
- parm.yaw += 60
- local.self turnto parm.yaw
- wait 5
-
- // Hmmm, didn't see anything. Must have been nothing.
- // Go back to where we started
- local.self walkto local.startpos
- waitFor local.self
-
- local.self state act_idle
- end
-
- //************************************************************
- //
- // runtoarea:
- // Actor runs to location and fights enemies along the way
- //
- //************************************************************
-
- runtoarea:
-
- local.self clearstate
-
- // increase his paranoia a bit (gunshots usually come in large quantities)
- local.paranoia += 2
-
- // run over there
- local.self behavior Investigate "run" local.location
- waitFor local.self
-
- // stand around for a bit
- local.self anim idle
- waitFor local.self
- wait 5
-
- parm.yaw = local.yaw
- parm.yaw += 120
- local.self turnto parm.yaw
- wait 5
-
- parm.yaw = local.yaw
- parm.yaw += 120
- local.self turnto parm.yaw
- wait 5
-
- // Hmmm, didn't see anything. Must have been nothing.
- // Go back to where we started
- local.self walkto local.startpos
- waitFor local.self
-
- local.self state act_idle
- end
-
- //************************************************************
- //
- // sightenemy:
- // Actor sees an enemy for the first time
- //
- //************************************************************
-
- sightenemy:
-
- local.self clearstate
-
- // crank up his paranoia level
- local.paranoia += 20
-
- goto fireundercover
-
- //************************************************************
- //
- // fireundercover:
- // Actor searches for enemy and uses cover
- //
- //************************************************************
-
- fireundercover:
-
- local.self clearstate
-
- local.self respondto act_runtoarea runtoarea
- local.self respondto act_twitch twitch
- local.self respondto act_stop idle
-
- local.self ignore act_activated act_used act_sightenemy act_nearfriend
- local.self ignore act_weaponsound act_movementsound act_painsound act_deathsound act_breakingsound
- local.self ignore act_doorsound act_mutantsound act_voicesound act_machinesound act_radiosound
-
- local.self respondto act_range_melee ""
- local.self respondto act_range_near ""
- local.self respondto act_range_med ""
- local.self respondto act_range_far ""
-
- local.self respondto act_health_danger ""
- local.self respondto act_health_low ""
- local.self respondto act_health_med ""
- local.self respondto act_health_ok ""
-
- fireundercoverloop:
-
- local.self behavior FireFromCover "run"
- waitFor local.self
-
- goto fireundercoverloop
- end
-