The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
#1
Elevator Lever to Level Transition

I've been sitting here ages trying to figure this script out, even tearing apart other scripts, and nothing is working. Obviously, I am missing something.

The idea is the rods will unlock the levers (which has not been scripted), and the levers will allow to the elevator to "move", which results in a level transition when the elevator lever is pulled down.

Some things may look a bit weird (like a sob activating when the lever puzzle is complete), but these are just stand-ins for the time being.

Here is the script as it is right now:

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);
}

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);
        }
        
    if(GetLeverState("elevator_lever_2") == -1)
    {
        SetEntityPlayerInteractCallback("elevator_lever_2", "Activate", true);
    }
}

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 Activate(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("", "14_elevator_activate.snt", "Player", 0, false);
    AddTimer("", 2.0, "Fade");
    StartScreenShake(0.06f, 4.0, 1.0, 1.0);
}

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

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

My scripting skills are still rather newbie level alas. This is about as far as I could get. :/

(This post was last modified: 11-26-2014, 06:40 AM by AGP.)
11-26-2014, 06:39 AM
Find


Messages In This Thread
Elevator Lever to Level Transition - by AGP - 11-26-2014, 06:39 AM
RE: Elevator Lever to Level Transition - by AGP - 11-26-2014, 07:51 AM
RE: Elevator Lever to Level Transition - by AGP - 11-26-2014, 08:48 AM
RE: Elevator Lever to Level Transition - by AGP - 11-26-2014, 08:38 AM
RE: Elevator Lever to Level Transition - by AGP - 11-26-2014, 08:57 AM
RE: Elevator Lever to Level Transition - by AGP - 11-26-2014, 09:03 AM
RE: Elevator Lever to Level Transition - by AGP - 11-26-2014, 09:13 AM
RE: Elevator Lever to Level Transition - by AGP - 11-26-2014, 09:36 AM



Users browsing this thread: 1 Guest(s)