Jump to content
  • 0

Problem with "If" and "ThingCount" (ACS)


Question

Hey everyone! I'm really new to this site and doom modding in general.

 

In my map I want to made so Cyberdemon and 8 Barons of Hell are fighting on the "ring". When one team dies, the crusher will be activated and will crush everyone else and bridge will raise, so player can continue, but there is a problem: I just can't get the code to work. The first part (when they infight) I already made and it works perfectly, but I cannot get the If statement to work (I also tried While but it does not work either).

 

Maybe it's because of "||" (Logical OR), but I don't know.

 

Here is my code so you can see what I did wrong.

 

1569673677_2024-04-07224048.png.c46e962d6fc0b28d572152e6887f19e4.png

Share this post


Link to post

3 answers to this question

Recommended Posts

  • 1
Posted (edited)

Right now your script runs once, and if neither the all the cyberdemons nor barons are dead when it runs, just skips that part and finishes and exits the script.

 

What you probably need is a loop in there that just waits for either group to be dead, and then completes the rest of the script.

 

something like this (COMPLETELY UNTESTED, MAYBE THERE ARE OTHER PROBLEMS TOO, YOU NEED TO TRY IT FOR YOURSELF)
 

script 1 (void)
{
    // first part, keep the same

    // second part
    until (ThingCount(T_CYBERDEMON, 11)==0 || ThingCount(T_BARON, 12)==0)
    {
        delay 35;
    }

    Ceiling_CrushRaiseAndStay(9, 32, 10000, 0);
    // other stuff after the crusher
}

 

You could also put the "waiting for a group to die" bit in an OPEN script that will run automatically at the start of the level. In your case probably either works.

Edited by plums

Share this post


Link to post
  • 0

Perhaps add in additional parameters for clarity so each half of the statement is taken as one whole and see if that helps:

 

If ((ThingCount(T_CYBERDEMON, 11) == 0) || (ThingCount(T_BARON, 12) == 0))

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...