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

Defensive monster behaviour?

Recommended Posts

How can I make it so that a monster is bound to "protect" another monster? The title might be misleading, i'm not talking about a monster that acts defensively, but a monster that stays around another monster, taking as much hits as possible for him. To make it more clear, i'm trying to get the shielded nobles from realm667 to protect another, more powerful noble. I don't even know if I have to wire it in the decorate or perhaps by using map scripting.

Thanks a lot!

Share this post


Link to post

I cannot imagine it possible at all. Doom's monster AI is individualistic, monsters don't care about each other, they don't even know about upcoming player's attacks / projectiles flying towards them, they only care about their target. What you would like to do is make your monster follow 2 targets at once (already impossible), try to stay in the middle between them somehow, and attack one of them (the player). DECORATE cannot do this. And affecting monster's position via some extremely elaborate ACS, if it would work as intended at all, would probably cause unsmooth, illogical, glitchy movements.

The only usable solution I can think of is to restrict the monster's movement (via monster blocking lines, raised ledges, etc) and surround the hell noble with a ring of protectors. Or you can just make the protectors walk much faster than the protected monster, so that they will be more probably closer to the player.

I suppose you would also like the protected monster to not hurt his protector, which requires to make him immune from the monster's projectile attacks (possible by changing "species" of both monsters to be the same one, or make one of them inherit from the other one).

Share this post


Link to post

I feel like you could use ACS to get the positions of the player and the monster you want protected, and then set the "protector" monster to walk towards a position between them using Thing_SetGoal or whatever.

Share this post


Link to post
Linguica said:

I didn't know that the "dontchasetarget" flag existed at all, apparently it allows to chase goal while attacking the real target, so it's indeed possible. Interesting, thanks. Your method could probably work.

Share this post


Link to post

Wow I thought I was deluding on this one. This engine haz no limitz. How can I mark the middle ground between them though?

Share this post


Link to post

Use ACS - GetActorX and GetActorY to get positions of the player and the protected hell noble. One of them (player or monster) should be the script activator and the other one should have a unique TID, or both should have unique TID. Then calculate average value of both X and Y coordinates, you might store them into a variable. Then use Thing_Spawn to spawn a patrol point (must have unique TID), and then immediately call Thing_SetGoal on the protector, who also must have a unique TID (or be the script activator, in which case both player and protected monster must have unique TIDs). Keep in mind that this script needs to be running every tic while the protected monster is alive and active, you will need additional programming to ensure that. Also keep in mind that every time right before you spawn the patrol point, you need to remove the old one (by its TID).

I didn't say it would be easy. :)

Alternatively, you can calculate the angle from the protected monster to the player, and spawn the patrol point relative to the monster, with said angle and a fixed distance (relatively short, like 128 units). This would guarantee that the protector will always stay relatively close to the protected monster, while still in the way between the monster and the player.

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
×