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

Issue with linedef action breaking script

Question

Hi, I'm very, very new to making things in Doom and I've been learning by rote and watching tutorials. 

 

Essentially what I want to do in this room, is the exit portal is in the centre. I want that to raise up when the player walks over the appropriate linedef. This works.

 

Before then, I had the platform raised already and wanted it to lower when all the enemies in the room were killed. This script for doing that was working before adding the previous function. 

 

#include "zcommon.acs"

script 1 (void) {
    if(ThingCount(T_NONE,2)==0) {
     Plat_DownByValue (3,32,0,14);
    }
}

I'm not sure what the issue is, unless its a limitation where I can't do both of those things with the same sector. Be grateful for any help. 

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 0

You're using the wrong actions. The Plat* are for lifts (move up/down, wait, move down/up), you want Floor* ones. The action of the line that raises the teleporter should be "Floor Raise by value" (23), or "Floor Raise by Value * 8" (35). And in the script you should use Floor_LowerByValue. Also your script should be "open", not "(void)", which means it'll start to execute when the map starts. Triggering it later will work too, of course. So the script should be something likes this:

 

#include "zcommon.acs"

script 1 open {
    while (ThingCount(T_NONE,2)) {
        Delay(3);
    }
    Floor_LowerByValue(3, 8, 14*8);
}

It's interesting that a delay of 0 in the Plat* actions seem to make them not move into the opposite direction at all. If the sector is still moving from the engine's point of view it's normal that no other action will be applied to it.

 

Share this post


Link to post
  • 0
Posted (edited)

Could you be a bit more explicit about your setup? Maybe attach the map?

 

For scripts that do something once all monsters are dead, you'll usually want your script to loop. As you have it now, your script runs, and does something if the monsters tagged 2 are all dead. However, unless your map calls that script repeatedly, that's all it does. If the script is called only once, and the monsters aren't all dead yet when it's called, then nothing happens, but the script has run.

 

A way to make the script loop would be to change it like this:

#include "zcommon.acs"

script 1 (void) {
    while (ThingCount(T_NONE,2)) {
        Delay(3);
    }
    Plat_DownByValue (3,32,0,14);
}

Explanation of the change: there, the script runs (just once, again), but instead of doing something if there are no monsters, it does something that loops while there are monsters. And what it does is wait three tics (you can change it, go as low as 1). So if there are still monsters around, the script goes on standby for three tics, then checks again, and so on until the monster counts returns 0 and it finally exits the loop.

Upon leaving the loop, it runs the instruction to lower the platform.

Share this post


Link to post
  • 0

I tried making that script change but it didn't do anything either. I can attach the map, it should be fairly clear what I'm trying to do. 

 

 

Test02.zip

Share this post


Link to post
  • 0
Posted (edited)

Thanks Boris, when I put in that script, and then also corrected the linedef to raise it as a floor instead of a platform, it all works as intended. 

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
×