Jump to content
pablogener

ACS: Assign a line to trigger a lift, scripted.

Recommended Posts

I have this lift that should work 'automatically' when the player gets on it, but not before something else is done. I want my player to try to get on the lift, nothing would happen, he would then have to go up to a computer terminal and press 'use' on it, go back to the lift, then the lift would work ok.
how can I get it done?

thanks for your time!!

Share this post


Link to post

This is how I would do it. Dunno if it works of not though.


script 1 (void)//for the lift
{
if(ActivatorTID == 1)
{
Plat_UpWaitDownStay (tag, speed, delay);
}
else
{
print(s:"No power!");
}
}

script 2 (void)//for the control panel

{
Thing_ChangeTID (0,1);
}

Share this post


Link to post

make global variable (outside scripts) called liftActivated = 0; or whatever. Computer switch sets it to 1.
Walking on the lift does:
if liftactivated == 1: bla

Share this post


Link to post

I did it gggmork's way, figure it out myself later. krispy's way seems better, though. It's actually working fine right now, so I wouldn't change it (don't fix it if it's not broken, right?), anyway, I didn't take into account that the player itself could be a carrier of a 'flag-acting' variable, with that TID value. it's a much useful resource, thanks for the tip.

Share this post


Link to post

just in case you guys wanted to checkout the code I produced, here it is:

script 11 (void)
//for the lift
{
    if (pReroutePower == 0)
    {
        light_flicker(35,255,80);
        print(s:"Lift offline. Reroute backup power to operate");
    }
    else
    {
        floor_raisebyvalue(35,4,255);
        delay(140);
        exit_normal(0);
    }
    
}

script 12 (void)
//for the panel
{
    pReroutePower = 1;
    light_fade(36,255,70);
    print(s:"Backup power on. Service lift operation restored");

}

Share this post


Link to post

Now I bet you can run in and out of the lift really quick to make it go up without you and get stuck.

Share this post


Link to post

I see the lift is supposed to exit anyway, but you can prevent that by making another global variable:
int liftPosition = "down";
then put another if/else, nested inside of your else above.

if liftPosition=="down": lift goes up, liftPosition="up"
else: lift goes down, liftPosition="down"

So you can keep pressing the lift up/down.

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

×