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

Killing A Group of Enemies Opens a Door

Question

How do you tie events such as opening a door to killing the entirety of a group of monsters.

 

Currently in the GZDoom Builder editor, I can only make it so that when any one of the group members is killed, the door opens.

 

 

Share this post


Link to post

17 answers to this question

Recommended Posts

  • 0
#include "zcommon.acs"

script 12 (void) {
    if(ThingCount(T_NONE,34)==0) {
        Door_Open(56,16);
    }
}

In thing properties of monsters belonging to the group, set a Tag "34" and an Action "ACS_ExecuteAlways" with Argument1 "12". Then, in the game, once the last one of these monsters dies, a door with Tag "56" will open with speed "16". Of course, the numbers 12, 34, 56 and 16 are arbitrary, change them to whatever numbers suit your map. Your map must be in Hexen format or UDMF for this to be possible, not in Doom format, in which you can't assign Tags and Actions to things (in your case, to monsters). And of course, a modern ZDoom-based port (or whatever port that supports both the map format and ACS scripts) will be required to play the map, classic ports tend to only support the Doom map format and not support ACS at all.

Edited by scifista42

Share this post


Link to post
  • 0

Give all monsters in the group a specific tag and an ACS_ExecuteAlways action to execute a script that uses ThingCount to count the number of living monsters with said specific tag and opens a door if the number is 0.

Share this post


Link to post
  • 0

Do i need to use a script? Because there are many times in the original doom games where id did that. Or am I an idiot because they did use scripts?

Share this post


Link to post
  • 0

Scripts didn't exist when the original games were made. Whenever an original game has a sector action take effect after a group of monsters is killed, it's actually an action hardcoded (unchangeably) into the engine for the specific map slot and/or specific monster type and specific sector action. In ports that don't support scripts, the only way of having sector action take effect after a group of monsters is killed is to make a map for the same specific map slot and use the same specific monster type as in the original games, and then the same specific sector action will take effect. In ports that support scripts, scripting allows making this a lot more flexible.

Edited by scifista42

Share this post


Link to post
  • 0

Doom 1:

E1M8: All Barons killed -> Floor tagged 666 lowers.

E2M8: All Cyberdemons killed -> Level exited.

E3M8: All Spider Masterminds killed -> Level exited.

E4M6: All Cyberdemons killed -> Door tagged 666 opens.

E4M8: All Spider Masterminds killed -> Floor tagged 666 lowers.

Doom 2:

MAP07: All Mancubi killed -> Floor tagged 666 lowers.

MAP07: All Arachnotrons killed -> Floor tagged 667 raises by lowest texture height.

Share this post


Link to post
  • 0

That's something different, it's not hardcoded in the engine to the map slot, but the Keen death action opens 666-tagged doors on any map.

Share this post


Link to post
  • 0

You can also just give all the monsters a TID and then do an OPEN script to do While(ThingCount(0, tid) > 0) Delay(tics); and then do the door open stuff after this line.

 

Now if the monsters spawn in first you will need to do your monster spawn action like Thing_SpawnFacing or whatever, then give a new TID in that. I like to use a 1-tic delay between that and the ThingCount so the game has time to register that a thing with a TID of whatever exists on the map.

 

I've had problems before where spawning then and doing a while in the same tic caused unpredictable results.

Share this post


Link to post
  • 0

Can someone give me a screenshot of an example script which would do such a thing? Sorry, haven't touched the script editor.

Share this post


Link to post
  • 0

Also forgot to mention, a Boom compatible way to do a timed door is purely by guessing and using a voodoo doll. Have your monsters in the room, then upon entering the room trigger a scroller or door to open to allow a voodoo doll to pass and make the corridor it travels down long enough so that you would have killed all the monsters by the time it would open. Might need to do it about 5 times and get an average time. skillsaw does this quite a bit, that is I think this is the method he uses.

Share this post


Link to post
  • 0
18 minutes ago, HyperLuke said:

What do I do once I have the script compiled?

Playtest the map to see if it works?

Share this post


Link to post
  • 0

Having another dumb issue, I did the same thing, except with the Lower Floor by Value Command, with a different group of monsters, and it did not work.

 

capture6.PNG.13d5204884a51215146f65ab6d32e880.PNG

Share this post


Link to post
  • 0

are you sure that you tagged everything properly?

 

try this

#include "zcommon.acs"
script 13 open
//  20:Floor_LowerByValue ( tag, speed, height );

{
    While ( ThingCount ( T_NONE, 4 ) > 0 )
    Delay(35);
    Floor_LowerByValue ( 11, 16, 192 );
}

 

TAG4.7z

Edited by Kappes Buur : use a while loop

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
×