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

Monster Scripts

Question

So i want to make a room that makes the player clear the room, before making a keycard appear, but I duck ass at scripting, how would this be done?

Ex. ( player fights like 15 monsters, and the last one dies, and makes the key card appaear)

Share this post


Link to post

3 answers to this question

Recommended Posts

  • 1

It's easy enough with a simple OPEN script.

All you need to do is use a couple of action specials:

#include "zcommon.acs"

// int ThingCount (int type, int tid);
// 135:Thing_Spawn (tid, type, angle, newtid)

script 200 OPEN
{
    While (ThingCount(T_NONE, 11) > 0)
    Delay(35);
    Thing_Spawn ( 10, T_REDSKULLKEY, 0, 0);
}

 Example pwad

FRAG_ALL.7z

Edited by Kappes Buur

Share this post


Link to post
  • 0
21 hours ago, Kappes Buur said:

It's easy enough with a simple OPEN script.

All you need to do is use a couple of action specials:


#include "zcommon.acs"

// int ThingCount (int type, int tid);
// 135:Thing_Spawn (tid, type, angle, newtid)

script 200 OPEN
{
    While (ThingCount(T_NONE, 11) > 0)
    Delay(35);
    Thing_Spawn ( 10, T_REDSKULLKEY, 0, 0);
}

 Example pwad

FRAG_ALL.7z

Now which part of the script would I change so that there could be more enemys than you spawned? also, how would I make a script that opens a door, after that last demon is killed, and does the same thing again? sorry if these are considered easy questions, im still semi new at mapping, and I know close to nothing with scripting

Share this post


Link to post
  • 0
On 10/24/2020 at 11:28 PM, 2009XboxLiveKid said:

Now which part of the script would I change so that there could be more enemys than you spawned? also, how would I make a script that opens a door, after that last demon is killed, and does the same thing again? sorry if these are considered easy questions, im still semi new at mapping, and I know close to nothing with scripting

 

That script works so that no matter how many enemies you have, it always loops to check if any are alive. In this case, it checks any monsters with a TID of 11. If it counts 0 enemies (meaning they are dead and do not have a TID) it breaks the while loop and goes on to do whatever you specify after.

 

 While (ThingCount(T_NONE, 11) > 0)

This says as long as enemies with a TID of 11 are alive, do the following:

 

Delay(35);

Which is to wait. This is a loop, so it's going to constantly check to see if enemies with a TID of 11 are alive. When they are all dead, it spawns the Red Skull Key:

 

Thing_Spawn ( 10, T_REDSKULLKEY, 0, 0);

If you want a door to open, you'd need to use a Door function like Door_Open and put that at after this Thing_Spawn line.

 

As for doing the whole process again, you could simply just call the script again at the end:

 

ACS_Execute(200, 0);

I believe that will work, but untested of course.

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
×