Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Elevator Lever to Level Transition
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#11
RE: Elevator Lever to Level Transition

It's scripted so that the levers become stuck once they are all in the proper positions. I have tried it once where pulling the elevator lever before pulling the other levers did make them stuck. Other than that, they just stay stuck.

For the levers in the little lever box (the one with the Roman numerals), the -1 is up.

And there are no callbacks on 2.

(This post was last modified: 11-26-2014, 08:58 AM by AGP.)
11-26-2014, 08:57 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#12
RE: Elevator Lever to Level Transition

Alright, so the lever_machine_lever ones run the block once interacted with. If all those levers are in state -1 when one of them is, it makes them all stuck and plays the sounds. The issue here is that elevator_lever_2 has no way of being in state -1 before this happens, therefore the last part of the block can never be called; thus the Activate block never runs either.

What you can do is to use a variable instead. Add another lever callback to the elevator_lever_2 and have it check for this variable. You trigger it in the "stuck" script.
PHP Code: (Select All)
void LeverBox(string &in asEntityint LeverState)
{
    if(
GetLeverState("lever_machine_lever_1") == -1
    
&& GetLeverState("lever_machine_lever_2") == -1
    
&& GetLeverState("lever_machine_lever_3") == -1
    
&& GetLeverState("lever_machine_lever_4") == -1
    
&& GetLeverState("lever_machine_lever_5") == -1
    
&& GetLeverState("lever_machine_lever_6") == -1)
    {
        
PlaySoundAtEntity("""sob01.snt""Player"0false);
        
SetEntityActive("elevator_lever_1"false);
        
SetEntityActive("elevator_lever_2"true);
                
        for(
int i 1<= 6i++)
        
SetEntityInteractionDisabled("lever_machine_lever_"+itrue);
        
SetLocalVarInt("Lever"1);//Added this line which is used when interacting with the elevator_lever_2
    
}
}

void ElevatorLever(string &in asEntityint LeverState)
{
    if(
GetLocalVarInt("Lever") != 0) {
        if(
GetLeverState(asEntity) == -1Activate();
    }


To use this, you must also remove the parameters of Activate, since it uses none.

(This post was last modified: 11-26-2014, 09:07 AM by Mudbill.)
11-26-2014, 09:00 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#13
RE: Elevator Lever to Level Transition

My biggest problem was I just couldn't figure out a way to call up the Activate function.

11-26-2014, 09:03 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#14
RE: Elevator Lever to Level Transition

Edited my reply with an alternate solution.

11-26-2014, 09:06 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#15
RE: Elevator Lever to Level Transition

Don't think I entered it in correctly:

void OnStart()
{

}

void OnEnter()
{    
    AddUseItemCallback("", "guiding_rod01", "rodarea_1", "RodMeOnce", true);
    AddUseItemCallback("", "guiding_rod02", "rodarea_2", "RodMeTwice", true);
    AddUseItemCallback("", "guiding_rod03", "rodarea_3", "RodMeThrice", true);
    
    for(int i = 1; i <= 3; i++)
    AddUseItemCallback("", "guiding_rod0"+i, "rodarea_"+i, "RodMe", true);
}

void OnLeave()
{

}

void LeverBox(string &in asEntity, int LeverState)
{
    if(GetLeverState("lever_machine_lever_1") == -1
    && GetLeverState("lever_machine_lever_2") == -1
    && GetLeverState("lever_machine_lever_3") == -1
    && GetLeverState("lever_machine_lever_4") == -1
    && GetLeverState("lever_machine_lever_5") == -1
    && GetLeverState("lever_machine_lever_6") == -1)
    {
        PlaySoundAtEntity("", "sob01.snt", "Player", 0, false);
        SetEntityActive("elevator_lever_1", false);
        SetEntityActive("elevator_lever_2", true);
                
        for(int i = 1; i <= 6; i++)
        SetEntityInteractionDisabled("lever_machine_lever_"+i, true);
        SetLocalVarInt("Lever", 1);
    }
}

void ElevatorLever(string &in asEntity, int LeverState)
{
    if(GetLocalVarInt("Lever") != 0) {
        if(GetLeverState(asEntity) == -1) Activate();
        
        PlaySoundAtEntity("", "14_elevator_activate.snt", "Player", 0, false);
        AddTimer("", 2.0, "Fade");
        StartScreenShake(0.06f, 4.0, 1.0, 1.0);
    }

void RodMeOnce(string &in asItem, string &in asEntity)
{
    SetEntityActive("guiding_rod01_stat", true);
    PlaySoundAtEntity("", "13_rod_in.snt", "rods", 0, false);
    RemoveItem("guiding_rod01");
    AddLocalVarInt("Rods", 1);
    
    if(GetLocalVarInt("Rods") == 3)
    {
        PlaySoundAtEntity("", "13_machine_extra.snt", "machine_sound", 0, false);
        PlaySoundAtEntity("", "13_machine_run.snt", "machine_sound", 0, false);
    }
}

void RodMeTwice(string &in asItem, string &in asEntity)
{
    SetEntityActive("guiding_rod02_stat", true);
    PlaySoundAtEntity("", "13_rod_in.snt", "rods", 0, false);
    RemoveItem("guiding_rod02");
    AddLocalVarInt("Rods", 1);
    
    if(GetLocalVarInt("Rods") == 3)
    {
        PlaySoundAtEntity("", "13_machine_extra.snt", "machine_sound", 0, false);
        PlaySoundAtEntity("", "13_machine_run.snt", "machine_sound", 0, false);
    }
}

void RodMeThrice(string &in asItem, string &in asEntity)
{
    SetEntityActive("guiding_rod03_stat", true);
    PlaySoundAtEntity("", "13_rod_in.snt", "rods", 0, false);
    RemoveItem("guiding_rod03");
    AddLocalVarInt("Rods", 1);
    
    if(GetLocalVarInt("Rods") == 3)
    {
        PlaySoundAtEntity("", "13_machine_extra.snt", "machine_sound", 0, false);
        PlaySoundAtEntity("", "13_machine_run.snt", "machine_sound", 0, false);
    }
}

void Fade(string &in asTimer)
{
    FadeOut(5);
    AddTimer("", 5, "TimerTransition");
}

void TimerTransition(string &in asTimer)
{
        ChangeMap("helena_001.map", "PlayerStartArea_1", "", "");
}

It's now saying unexpected end of file (101, 2).

11-26-2014, 09:13 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#16
RE: Elevator Lever to Level Transition

Missing bracket in ElevatorLever. If you're gonna have all that in the if statement, use another block there as well.

PHP Code: (Select All)
void ElevatorLever(string &in asEntityint LeverState)
{
    if(
GetLocalVarInt("Lever") != 0) {
        if(
GetLeverState(asEntity) == -1) {
            
Activate();
        
            
PlaySoundAtEntity("""14_elevator_activate.snt""Player"0false);
            
AddTimer(""2.0"Fade");
            
StartScreenShake(0.06f4.01.01.0);
        }
//end if
    
}//end if
}//end block 

(This post was last modified: 11-26-2014, 09:23 AM by Mudbill.)
11-26-2014, 09:23 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#17
RE: Elevator Lever to Level Transition

Compiling void ElevatorLever(string&in, int)

No matching signatures to 'Activate()'

Does this mean there are incorrect parameters? (Trying to comprehend what's going on, please forgive any silly-sounding questions.)

11-26-2014, 09:36 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#18
RE: Elevator Lever to Level Transition

It looks like you moved the contents from Activate to this block instead, which is fine. Just remove the Activate(); call then, since it doesn't exist.

11-26-2014, 09:44 AM
Find




Users browsing this thread: 1 Guest(s)