We are searching for a good scripter

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

The forums have been archived. Please read this thread for more information.

  • Awesome :3

    Here is the the thing we need help with XD

    Okay, we'll say 5 levers.

    1 False
    2 True
    3 False
    4 False
    5 True

    Code Section 1
    When a True lever is pulled in state 1, timer starts.
    The lever is locked in its state.If you pull a False Lever, timer gets resetted and states return to 0.

    Code Section 2
    When a True lever is pulled in state 1, timer starts. The lever is locked in its state.
    If the time ends, the state return to 0 and the timer gets resetted.

    Code Section 3
    When both True levers are pulled, all lever states get locked, sanityboost and shelf opened.
  • Ok, this will be a big bit of text but it was fun making it c:


    void OnStart()
    {
    SetLocalVarInt("DoorOpen", 0);
    SetEntityConnectionStateChangeCallback("lever_simple01_1", "lever_func1");
    SetEntityConnectionStateChangeCallback("lever_simple01_2", "lever_func2");
    SetEntityConnectionStateChangeCallback("lever_simple01_3", "lever_func3");
    SetEntityConnectionStateChangeCallback("lever_simple01_4", "lever_func4");
    SetEntityConnectionStateChangeCallback("lever_simple01_5", "lever_func5");
    }

    void lever_func1(string &in asEntity, int alState)
    {
    if (alState ==1) //down
    {
    RemoveTimer("TooLate");
    SetLeverStuckState("lever_simple01_2", 0, false);
    SetLeverStuckState("lever_simple01_5", 0, false);
    StopSound("ticker", 0);
    StopSound("ticker2", 0);
    SetLocalVarInt("DoorOpen", 0);
    }

    if (alState ==-1) //up
    {
    RemoveTimer("TooLate");
    SetLeverStuckState("lever_simple01_2", 0, false);
    SetLeverStuckState("lever_simple01_5", 0, false);
    StopSound("ticker", 0);
    StopSound("ticker2", 0);
    SetLocalVarInt("DoorOpen", 0);
    }
    }

    void lever_func2(string &in asEntity, int alState)
    {
    if (alState ==1) //down
    {
    AddTimer("1", 5, "TooLate");
    PlaySoundAtEntity("ticker", "gameplay_tick_long_dist.snt", "lever_simple01_1", 0, false);
    AddLocalVarInt("DoorOpen", 1);
    SetLeverStuckState("lever_simple01_2", 1, false);
    func_on();
    }
    }

    void lever_func3(string &in asEntity, int alState)
    {
    if (alState ==1) //down
    {
    RemoveTimer("TooLate");
    SetLeverStuckState("lever_simple01_2", 0, false);
    SetLeverStuckState("lever_simple01_5", 0, false);
    StopSound("ticker", 0);
    StopSound("ticker2", 0);
    SetLocalVarInt("DoorOpen", 0);
    }

    if (alState ==-1) //up
    {
    RemoveTimer("TooLate");
    SetLeverStuckState("lever_simple01_2", 0, false);
    SetLeverStuckState("lever_simple01_5", 0, false);
    StopSound("ticker", 0);
    StopSound("ticker2", 0);
    SetLocalVarInt("DoorOpen", 0);
    }
    }

    void lever_func4(string &in asEntity, int alState)
    {
    if (alState ==1) //down
    {
    RemoveTimer("TooLate");
    SetLeverStuckState("lever_simple01_2", 0, false);
    SetLeverStuckState("lever_simple01_5", 0, false);
    StopSound("ticker", 0);
    StopSound("ticker2", 0);
    SetLocalVarInt("DoorOpen", 0);
    }

    if (alState ==-1) //up
    {
    RemoveTimer("TooLate");
    SetLeverStuckState("lever_simple01_2", 0, false);
    SetLeverStuckState("lever_simple01_5", 0, false);
    StopSound("ticker", 0);
    StopSound("ticker2", 0);
    SetLocalVarInt("DoorOpen", 0);
    }
    }

    void lever_func5(string &in asEntity, int alState)
    {
    if (alState ==1) //down
    {
    AddTimer("1", 5, "TooLate");
    PlaySoundAtEntity("ticker2", "gameplay_tick_long_dist.snt", "lever_simple01_1", 0, false);
    AddLocalVarInt("DoorOpen", 1);
    SetLeverStuckState("lever_simple01_5", 1, false);
    func_on();
    }
    }


    void TooLate(string &in asTimer)
    {
    RemoveTimer("");
    SetLeverStuckState("lever_simple01_2", 0, false);
    SetLeverStuckState("lever_simple01_5", 0, false);
    StopSound("ticker", 0);
    StopSound("ticker2", 0);
    SetLocalVarInt("DoorOpen", 0);
    }

    void func_on()
    {
    if (GetLocalVarInt("DoorOpen") == 2)
    {
    SetSwingDoorLocked("castle_1", false, false);
    SetLeverStuckState("lever_simple01_1", 1, false);
    SetLeverStuckState("lever_simple01_2", 1, false);
    SetLeverStuckState("lever_simple01_3", 1, false);
    SetLeverStuckState("lever_simple01_4", 1, false);
    SetLeverStuckState("lever_simple01_5", 1, false);
    GiveSanityBoost();
    SetMoveObjectState("shelf",1.0f);
    PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
    return;
    StopSound("ticker", 0);
    StopSound("ticker2", 0);
    RemoveTimer("TooLate");
    }
    }


    For the shelf part. You need to go to wiki.frictionalgames.com/hpl2/…t/levers_and_secretshelfs and rename the shelf you are using to shelf for this to work. All the lever names are:

    lever_simple01_1
    lever_simple01_2
    lever_simple01_3
    lever_simple01_4
    lever_simple01_5

    Lever 1 and 5 a true. Pulling them both down in 5 seconds (message me if you want the timer increased or decreased) will complete the quest. And Pulling any of the other ones will always reset the Variable and Timer. Enjoy :D