Jump to content
  • 0

How to spawn monsters with the "Ambush Players" property?


mxrgan

Question

So for my map, I wanna spawn some enemies in one room after the player picks up a key in another room, but When the monsters are spawned, they are already alerted and go towards the player as soon as the spawn. And im using ACS scripts to spawn the monsters. Is there a way to assign the monsters an "Ambush Players" property as they spawn?

 

EDIT: I mean that I want the monsters to stay in place as they spawn, some of you just didnt get the memo, my bad.

Edited by BucketHoodie
I seriously miscommunicated my thing.

Share this post


Link to post

7 answers to this question

Recommended Posts

  • 1

I vaguely recall someone else asking this question, but I don't remember what the solution is. Meanwhile, I double checked the ZDooM wiki for SpawnSpot and Thing_Spawn, the 2 common ways to spawn an actor. Neither of them allows spawning something with the ambush flag set.

 

A hacky alternative is to spawn the enemies within a sector with sound-blocking linedefs (bitset 0x0044). Remember to use 2 sets of such linedefs, with one set completely enclosing the other. In this way, the enemy will be spawned behind a "sound wall", and will only be alerted when the player becomes visible.

Share this post


Link to post
  • 1

Is there a reason you're not simply setting the monsters in a closet outside the playable area and then use TeleportOther to bring them in? Giving them the ambush flag should prevent them from moving until you get there.

Share this post


Link to post
  • 0
10 hours ago, BucketHoodie said:

So for my map, I wanna spawn some enemies in one room after the player picks up a key in another room, but When the monsters are spawned, they are already alerted and go towards the player as soon as the spawn. And im using ACS scripts to spawn the monsters. Is there a way to assign the monsters an "Ambush Players" property as they spawn?

 

https://zdoom.org/wiki/Actor_flags

BEHAVIOR - Ambush

Share this post


Link to post
  • 0

The ambush flag makes it so that they stay in place until they see the player, that's not what you want. If the player is the activator of the script, you can use Thing_Hate(tid, 0, 4) where tid is the id of the monster

Share this post


Link to post
  • 0
7 hours ago, magicsofa said:

The ambush flag makes it so that they stay in place until they see the player, that's not what you want. 

I know what that is and I want it, I accidentally miscommunicated somethings..

Share this post


Link to post
  • 0
5 hours ago, Aurelius said:

Is there a reason you're not simply setting the monsters in a closet outside the playable area and then use TeleportOther to bring them in? Giving them the ambush flag should prevent them from moving until you get there.

Yes, this is a better way of doing things than using sound-blocking linedefs in a mod that uses ZDooM features.

Share this post


Link to post
  • 0

Using the default ACS spawning scripts results in monsters that do not have the ambush flag set. Better do what Aurelius suggested: put your extra monsters in a dummy box somewhere and give them the ambush/deaf flag and a TID and use SetActorPosition or somesuch to move the extra monsters from the box to the desired area.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...