Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
DooMBoy

#456th scripting question

Recommended Posts

Alright, I'm doing another level that I'm going to call The Stronghold. It replaces map26, if anyone cares, which I'm sure you don't :p
To cut to the chase, there's a lot of enemies in this map, and the actual stronghold itself lies behind a raised wall. The thing is, I want this wall to lower to the ground once all of the enemies are dead, not just a certain type (like Mancubi or Arachnotrons). If anyone knows how to do this, please tell me. I will greatly appreciate it :)

Share this post


Link to post

Give all the enemies the same TID and use this TID as the second argument for Thing_Count, leaving the first argument out, like (if your TID is 123)
Thing_Count(0, 123);

Share this post


Link to post

This should work... give all the enemies a tid, and then use thingcount.

You are probably used to using thingcount like this:

ThingCount(T_BARON, 0);

where you identify the thing to be counted by type. The second parameter, however is for the tid.

I think:

ThingCount(T_BARON, 1);

Would only count Barons with a tid of 1, and ignore the others, whereas:


ThingCount (0, 1);

Would count anything with a tid of 1.


Edit: OK, so I had this sitting open in my browser for a while before answering and Tarin got in before me!

Share this post


Link to post

OK, I've given all the enemies in my map the tid of 1. Here is the script itself:
script 2 (void)
{
ThingCount (0, 1);
Floor_LowerToNearest (5, 60);
}
Now, for whatever reason, when I kill all the enemies, the wall doesn't lower, and so the level can't go on. I made sure the wall had the tag of 5 (script?) just to be sure. It doesn't work, though. What's up with that?

Share this post


Link to post
DooMBoy said:

script 2 (void)
{
ThingCount (0, 1);
Floor_LowerToNearest (5, 60);
}

Well, when does this script get executed? Change it to this and it should work:

script 2 open
{
if(ThingCount (0, 1) == 0) {
Floor_LowerToNearest (5, 60);
}
else {
delay(1); // important!
restart;
}
}

Share this post


Link to post

This setup works for me: (all relevant monsters have tag 33, floor has tag 34)



script 2 OPEN

{
print(s:"you need to kill everything before the wall lowers");
while (thingcount (0, 33))
{
delay(35);
}
Floor_LowerToLowest (34, 32);
print(s:"a wall has lowered.");
}

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
Sign in to follow this  
×