Frictional Games Forum (read-only)
Clinging to ladder after falling 2 floors - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Clinging to ladder after falling 2 floors (/thread-23302.html)



Clinging to ladder after falling 2 floors - CarnivorousJelly - 09-21-2013

I have a little teeny-tiny scripting problem - might be a level editor problem, I'm not entirely sure:

What's supposed to happen - Player is climbing a bookshelf to grab a specific book, get's about... 3/4 of the way there and loses grip. They then fall 6m-ish flat on their back and black out.
What is actually happening - Player climbs up, loses grip at 3/4 of the way up, falls, blacks out. Trying to move forward upon waking up results in climbing up the shelf.

This is the script:
Code:
void Script_Fall (string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("gasp", "react_scare.snt", "Player", 0, false);
    AddTimer("F1", 0.1f, "timer_fall");
    AddTimer("F2", 0.5f, "timer_fall");
    AddTimer("F3", 0.8f, "timer_fall");
    AddTimer("F4", 1.0f, "timer_fall");
    AddTimer("F5", 2.5f, "timer_fall");
    AddTimer("F6", 6.1f, "timer_fall");
}

void timer_fall(string &in asTimer)
{
    if(asTimer == "F1")
    {
        AddPlayerBodyForce(-1000, -10000, -5500, false);
        StartPlayerLookAt("Area_Fall", 4, 5, "");
        AddPropForce("book02_17", 0.0f, -100.0f, -350.0f, "world");
        AddPropForce("book01_2", 0.0f, -100.0f, -350.0f, "world");
        AddPropForce("book03_153", 0.0f, -100.0f, -350.0f, "world");
        AddPropForce("book02_91", 0.0f, -100.0f, -350.0f, "world");
        AddPropForce("tome01_1", 0.0f, -100.0f, -350.0f, "world");
        AddPropForce("book03_152", 0.0f, -100.0f, -350.0f, "world");
        AddPropForce("book02_90", 0.0f, -100.0f, -350.0f, "world");
        AddPropForce("book03glowing_1", 0.0f, -100.0f, -350.0f, "world");
    }
    
    if(asTimer == "F2")
    {
        SetEntityActive("LadderArea_1", false);
    }
    
    if(asTimer == "F3")
    {
        StopPlayerLookAt();
        StartPlayerLookAt("Area_Look1", 5, 8, "");
    }
    
    if(asTimer =="F4")
    {
        StopPlayerLookAt();
        SetPlayerCrouching(true);
        FadePlayerRollTo(70, 50, 55);
        SetPlayerHealth(55);
        SetPlayerMoveSpeedMul(1.5f);
        GiveSanityDamage(20, true);
        FadePlayerFOVMulTo(1.0f, 4);
    }
    
    if(asTimer =="F5")
    {
        StartPlayerLookAt("Area_Fall", 15, 20, "");
        GiveSanityDamage(40, false);
        PlaySoundAtEntity("crash", "player_falldamage_max.snt", "Player", 0, false);
        FadeOut(4.0f);
        PlaySoundAtEntity("ringing", "insanity_ear_ring.snt", "Player", 4, false);
    }
    
    if(asTimer =="F6")
    {
        StopPlayerLookAt();
        StopSound("ringing", 2);
        FadePlayerRollTo(0, 50, 50);
        SetPlayerCrouching(false);
        SetPlayerMoveSpeedMul(1.0f);
        FadeIn(0.5f);
    }
}

There's about 3m between the shelf and the wall behind it, so I'm pretty sure that's not the problem.

Any suggestions?


RE: Clinging to ladder after falling 2 floors - DeAngelo - 09-21-2013

Try setting the ladder area inactive, I have something similar in my custom story. After the scene you can re-activate it if you want to let the player go back up.


RE: Clinging to ladder after falling 2 floors - CarnivorousJelly - 09-21-2013

Code:
if(asTimer == "F2")
    {
        SetEntityActive("LadderArea_1", false);
    }
I did that and it ended up not working :\ Unless I'm just using the wrong thing for it.


RE: Clinging to ladder after falling 2 floors - PutraenusAlivius - 09-21-2013

Make sure that the name is consistent with the one at the LevelEditor.


RE: Clinging to ladder after falling 2 floors - Daemian - 09-21-2013

This function ChangePlayerStateToNormal(); makes the player release the ladder.
Then, i would make the player look up with StartPlayerLookAt+area at the ceiling
and i'd have the player inactive in this events, mostly to stop him from grabbing the ladder again.


RE: Clinging to ladder after falling 2 floors - CarnivorousJelly - 09-21-2013

Thanks, Amn! I'll have to give that a try :)

(Thanks to everyone else that answered as well :P)