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

Lowering platforms

Recommended Posts

How do I get a platform (press to use) to go only to a certain level? The platforms keep going right down to the ground level when pressed and I want it to stop only at the level I am on (Hexen format)

Share this post


Link to post

to do it generically, you'll need a combination of GetSectorFloorZ and Floor_(Raise/Lower)ByValue in ACS

since hexen format doesn't support arguments greater than 255, what I'd do is tag the platform and floors you want it to stop at with a unique tag each, then send it to an ACS script like this one:

script 1 (int platformTag, int targetTag)
{
    int platformHeight = GetSectorFloorZ(platformTag, 0, 0);
    int targetHeight   = GetSectorFloorZ(targetTag, 0, 0);
    
    int diff = targetHeight - platformHeight;
    
    if (diff == 0) { terminate; }
    
    if (diff > 0) { Floor_RaiseByValue(platformTag, 8,  diff); } // 8 is the speed - 8 units per 8 tics
    else          { Floor_LowerByValue(platformTag, 8, -diff); }
}
so you'd be using ACS_ExecuteAlways (special 226), first argument 1 (the script number), second argument 0 (we want it to run on this map), third argument the tag of the platform sector, fourth argument the tag of the sector it should stop at

keep in mind if there's multiple sectors with the same tag that GetSectorFloorZ will grab the floor height of the sector with the lowest sector number (ie. usually the one created first)

Share this post


Link to post

You could do this in Boom by using the repeatable "lower/raise to nearest floor" linedef actions. There's also platform actions too, iirc, that will make the floor and ceiling travel at the same time.

Share this post


Link to post

I was looking for something like Floor_MoveToHeight, but there's a big issue with it in that you're limited to heights in the -255/255 range if you're using it on a line in hexen format, and if for some reason the target height changes, it's not flexible enough on its own

but yeah that'd simplify the second half of my six-line script down if you used it there

come to think of it, you'd need to do a ">> 16" on the target height if you're getting it from GetSectorFloorZ, since the line specials expect ints and not fixeds

Share this post


Link to post
Ijon Tichy said:

there's a big issue with it in that you're limited to heights in the -255/255 range if you're using it on a line in hexen format,

If you need a height outside of the -255 to 255 range, either use Floor_MoveToValueTimes8, or use Floor_MoveToValue inside a script, because the 0-255 argument value limit only applies when the action is used on a linedef's / thing's Action, not inside a script.

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
×