Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
ClumsyCryptid

Altering monster behavior - Possible?

Recommended Posts

While working on a crapwad of mine, it's essentially a megawad of maps that I've been compiling together as my skill increases, I've started work on this tech base. I'm still slowly breaking out of the newbie habit of rectangular rooms, long hallways, and general squareness.

So what started out as a sewage plant I based off of blue prints of a layout of a local sewage treatment plant I've slowly modified it as a re-purposed base for UAC scientists and researchers studying monster behaviors. While I've been slowly tuning the rooms to be better detailed, and making the layout easier on the eyes I got into my usual snowball train of thought.

Is it possible to modify the behaviors of the demons to react towards the player in a "modern" way?

An example that I can tie to this question is.. The player stumbles upon some imps, and a Baron of Hell. The player starts to damage the Baron, or kills several of the imps. The imps start to flee, or retreat while stopping, and lobbing fireballs at the player. While the Baron continue's it's attack. However if the Baron somehow dies before the imps the imps run away in fear.

Essentially I got this idea from the anubis command for ZDoom, and I'm curious if it's possible to alter the monster to respond in a behavioral method to that command without it being typed it, and per situation.

Or has my snowball become far too big for the coding to handle?

Note: This wad is probably not going to see the light of day. Unless I hit 32 levels in it, and decide to upload the crapwad to the /idgames ftp.

Edit: Just to give a general idea on the level count this is map 12 in said crapwad.

Share this post


Link to post

Making the monsters to "cooperate", or react to each other or to the player's actions, is generally very hard.

You can alter the monsters so that upon their death, they'll RadiusGive a certain custom inventory item to surrounding living monsters. This inventory item will, with a specified probability, give +FRIGHTENED flag to the affected living monster, which will make him to run from the player instead of towards him. Different monster types can do this with different radiuses and probabilities. The "specified probability" thing might be a little problematique to implement, but I'm sure that there should be a workaround to do it.

Share this post


Link to post

With a lot of scripting it's possible.

If you look at Stronghold: on the edge of chaos, monsters move toward their goal, sometimes pausing to lob a projectile at the player but only ever chasing their goal, they won't divert from their course.

So you can create a pathway for fleeing monsters, and have the "monster panic" script make them chase that goal. (With Thing_SetGoal obviously.) You can also increase their speed to make them really run away.

Then it's a question of having a script that monitors the imps and barons in that room. If the baron or more than six (or whatever value is appropriate) imps die, start the monster panic script.

Share this post


Link to post

A little messing around and i came up with this:

ACTOR BaronOfHellF : BaronOfHell 8675
{
  Species F
  States
  {
  Death:
    BOSS I 8
    BOSS J 8 A_Scream
    BOSS K 8 ACS_NamedExecuteAlways(Baron,0)
    BOSS L 8 A_NoBlocking
    BOSS MN 8
    BOSS O -1 A_BossDeath
    Stop
  }
}

ACTOR DoomImpF : DoomImp 8676
{
 Species F
  States
  {
  Death:
    TROO I 8
    TROO J 8 A_Scream
    TROO K 6 ACS_NamedExecuteAlways(Imp,0)
    TROO L 6 A_NoBlocking
    TROO M -1
    Stop
  XDeath:
    TROO N 5
    TROO O 5 A_XScream
    TROO P 5 ACS_NamedExecuteAlways(Imp,0)
    TROO Q 5 A_NoBlocking
    TROO RST 5
    TROO U -1
    Stop
  }
}
The DECORATE lump

A custom baron and imp that trigger a script when they die, and won't infight with eachother.

The script...
#include "zcommon.acs"


Script "Baron" (void)
{
if(ThingCount("BaronOfHellF",ActivatorTID())==0)
 {
 SetActorProperty(ActivatorTiD()+1,APROP_FRIGHTENED,1);
 }
}

Script "Imp" (void)
{
if(ThingCount(T_NONE,ActivatorTID())<=5)
 {
 SetActorProperty(ActivatorTID(),APROP_FRIGHTENED,1);
 }
}
Once all special Barons with a certain tag are dead, all custom imps with a tag above that will flee (Baron of tag 3 dies - all imps with a tag of 4 flee)
If an imp dies with 5 (or less) others left, the remainder will flee.

Share this post


Link to post

Thanks for the insight into this.

While I could make another thread, I'll instead add this second unrelated bit to this post.

How does one, again if possible, add PDA logs or similar to a level? This map is probably going to have the story about the level integrated into it rather than a description of

"After the invasion of Earth, and Doomguy's survival of the incident on Io, and the Quantum Accelerator incident. He's been tasked with scouting, and clearing out an abandoned UAC operations base in a restructured sewage plant on Earth.

Little is known about the facility other than it wasn't used to research portal technology, but into the Hell spawn on a physical, and psychological level. Most of the demons having to learn fear through communications with other demons about Doomguy's exploits.

As you approach the facility the metal gate that barred entrance shuts automatically on you, leaving your trusty double-barreled shotgun behind the gate.

Staring towards the ominous steps to the facility you ready your pistol, and prepare for the worse."

Which the above would make an interesting intermission slide, I'm still wanting to add research logs from the scientist's point of view. Aforementioned, if possible.

Share this post


Link to post

One thing that can be done is to make a PDA graphic and use a hudmessage command to display it, then print another hudmessage on top with the actual text. If you want monsters and such to pause while doing this, you can do what HocusDooM did and give the player a time freezer powerup, though at the moment doing this will stop the music (this might be up to changing, though). Making it a Strife dialog could also work, though that's a bit limited in some areas.

Someone can probably explain this better, but just in case I'll post an example wad later on when I've got a bit more energy.

Share this post


Link to post
GoatLord said:

I'd be very impressed to see this come to fruition, considering that AI still sucks even in modern games.


Which is why I'm more than less compelled to release it at some point. I just need to stop staring at rooms I've created, and adding useless detail to them. So far.. I think there's more detail in the initial room than in a single KDiZD level.

I got this idea for altering monster behavior from replaying Halo, and noting the behavior of Grunts to their superior counterparts.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×