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

Need a little help with with simple ZDoom script

Recommended Posts

I'm trying to get a floor to only lower if you have the blue key. I've copypasted enough stuff from the ZDoom Wiki to end up with this:

script 6 (void)
{
    if(CheckInventory("BlueCard"))
    {
        Floor_LowerToLowest(98, 8);
        Thing_SpawnFacing(101, 2, 1);
    }
    else
    {
        print(s:"you need the blue key, ya dumbo!");
    }
}
Which works... as long as you ONLY have the blue key card on you. If you have any of the other keys on you at the time you try to open it, the floor won't lower. What do I have to add to get the script to work? (I'm a bit of coding ditz so it'd probably be best if someone included a correct version of the code in their post to help me out)

Share this post


Link to post

Try this:

script 6 (void)
{
    if(CheckInventory("BlueCard")>0)
    ...
I have a similar script in one of my maps and it works without problems with the ">0"!

Share this post


Link to post

It's a void script, so I suppose it's started from a line (or maybe thing) with ACS_Execute. Why don't you use ACS_LockedExecute instead to remove the key check from the script itself?

Share this post


Link to post

I found out the issue was the linedef wasn't set to repeatable, (since I don't work with ZDoom often, I don't realize sometimes that's not set on by default) but from now on I'll likely try to get ACS_LockedExecute instead since that was the most common response I've gotten elsewhere I asked this.

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  
×