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

Creating new states

Recommended Posts

What are some tips for creating custom states? For example, I want to try to create a state where the monster follows a specified path until it sees or hears the player. Also, would this involve anything other than DECORATE?

Share this post


Link to post

For following paths, you might want to have that custom state sequence include calls to Thing_SetGoal. You can use specials directly in DECORATE code.

I think if you use a TID of 0 it'll affect only the activator (that is to say, the monster that calls that special from its states) but I'm not sure about that.

Share this post


Link to post

Is the monster supposed to walk in zig-zags? I tested this on a Former Sergeant, and it didn't keep to a straight path. Also, it didn't pause at the proper node, but at the one before it.

Share this post


Link to post

Never mind that last question, as I have a state that I want to create: Instead of the normal "alert" state (I'm not sure if that is its name), if a monster hears the player attack, a projectile hit a wall, or another monster get hit/killed, it will go investigate the area (at a speed slower than its normal movement speed) that it estimates the sound to have come from (that is going to be the tricky part). The monster will investigate this area for a while (5-10 seconds or so), and then return to its previous location. However, if it sees the player or the corpse of another monster in this state, it should go on alert. I also wanted this "investigation" state to be triggered when the monster momentarily spots the player (within a period of a few tics or so) instead of going on alert, but that part can wait. I'm not sure if a state like this is possible, but I would like to know if there is some way of creating it.

Share this post


Link to post

I have an idea on how to trigger this state, but I don't know how to set up the state itself. Could someone help me with this, or at least point me in the right direction?

Share this post


Link to post

AFAIK monsters can "lock in" to a specific THING as their target, and always home for its exact X,Y,Z coordinates, even if they appear to be wandering aimlessly, and even if the target moves.

In order to do an "area investigation", as you put it, the monster would have to be headed to the location where the sound was generated (even if the cause of the sound has moved), and not actively follow the player by tracking his map position (like they normally do).

This can't be done unless you use a modified state that causes the monster to "hunt" this fixed, "sound generated" position instead of the player.

A way to do that would be to spawn an invisible "sound decoy" object at the position of the player whenever a monster is alerted by hearing alone (not by visual contact), and have the monsters home into that object instead of the player's actual position.

Of course different monsters may be investigating different sound sources at the same time. Once the source is found however, if the player has moved and is not visible, the monsters should revert to either a dormant or an "aimless wander" state, without actually having the player as a target.

Share this post


Link to post

This is what I was going to do. I'm still curious about how to activate the Alert state when the monster sees a dead monster, though. But thanks for the help!

EDIT: This "Sound Source" thing that you mentioned is supposed to be dropped when the player fires or the hit monster screams, right? That is what I had in mind.

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
×