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
Clinging to ladder after falling 2 floors
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#1
Clinging to ladder after falling 2 floors

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:
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?

[Image: quote_by_rueppells_fox-d9ciupp.png]
(This post was last modified: 09-23-2013, 09:32 PM by CarnivorousJelly.)
09-21-2013, 05:08 AM
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#2
RE: Clinging to ladder after falling 2 floors

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.

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
09-21-2013, 05:41 AM
Find
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#3
RE: Clinging to ladder after falling 2 floors

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.

[Image: quote_by_rueppells_fox-d9ciupp.png]
(This post was last modified: 09-21-2013, 06:31 AM by CarnivorousJelly.)
09-21-2013, 06:31 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#4
RE: Clinging to ladder after falling 2 floors

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

"Veni, vidi, vici."
"I came, I saw, I conquered."
09-21-2013, 07:30 AM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#5
RE: Clinging to ladder after falling 2 floors

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.

09-21-2013, 08:07 AM
Find
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#6
RE: Clinging to ladder after falling 2 floors

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

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

[Image: quote_by_rueppells_fox-d9ciupp.png]
09-21-2013, 05:59 PM
Find




Users browsing this thread: 2 Guest(s)