Frictional Games Forum (read-only)
Glitchy/Jittery Sleep? - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Glitchy/Jittery Sleep? (/thread-4651.html)



Glitchy/Jittery Sleep? - theDARKW0LF - 09-22-2010

I copied another poster's code to make the player spawn in as if asleep, but when lying on his side, my character's view jitters back and forth rapidly - it's not staying still while on it's side like it should be...

The code I used was:
Code:
void wakeUp () {
    FadeOut(0);     // Instantly fades the screen out. (Good for starting the game)
    FadeIn(20);      // Amount of seconds the fade in takes
    FadeImageTrailTo(2, 2);
    FadeSepiaColorTo(100, 4);
    SetPlayerActive(false);    
    FadePlayerRollTo(50, 220, 220);                 // "Tilts" the players head
    FadeRadialBlurTo(0.15, 2);
    SetPlayerCrouching(true);              // Simulates being on the ground
    AddTimer("trig1", 11.0f, "beginStory");            // Change '11.0f' to however long you want the 'unconciousness' to last
}

void beginStory(string &in asTimer){
    ChangePlayerStateToNormal();
    SetPlayerActive(true);
    FadePlayerRollTo(0, 33, 33);        // Change all settings to defaults
    FadeRadialBlurTo(0.0, 1);
    FadeSepiaColorTo(0, 4);
    SetPlayerCrouching(false);
    FadeImageTrailTo(0,1);
}

But I have since edited it and integrated it into Pandemoneus' StartPlayerLookAt Intro, and it still jitters about both before and after... Any ideas why it is like this?


RE: Glitchy/Jittery Sleep? - jens - 09-22-2010

It's better you post the code you have instead of one of the example you used. I am guessing it is the startplayerlookat that has too high values or a bit of a conflict in script making it hard to it to make up its mind, so the camera stutters.


RE: Glitchy/Jittery Sleep? - theDARKW0LF - 09-22-2010

That's my point though, even before I integrated the StartPlayerLookAt into the WakeUp script, it still stuttered. But if it helps, I'll post my code below:

Code:
void Intro()
{
    AddDebugMessage("Begin Intro", false);
    SetPlayerCrouching(true);
    SetPlayerActive(false);
    FadeOut(0.0f);
    FadeIn(12.0f);
    FadeImageTrailTo(2, 2);
    FadePlayerRollTo(50, 220, 220);                 // "Tilts" the players head
    AddTimer("1", 2, "IntroTimer");
    AddTimer("2", 2.5f, "IntroTimer");
    AddTimer("3", 3, "IntroTimer");
    AddTimer("4", 4, "IntroTimer");
    AddTimer("5", 6, "IntroTimer");
}

void IntroTimer(string &in asTimer)
{
    if(asTimer == "1"){
        PlayGuiSound("player_cough.snt", 0.7f);
    }
    else if(asTimer == "2"){
        SetPlayerCrouching(false);
    }
    else if(asTimer == "3"){
        StartPlayerLookAt("candlestick_tri_1", 2.0f, 1.0f, "");
    }
    else if(asTimer == "4"){
        StopPlayerLookAt();
        StartPlayerLookAt("DoorScript", 3.0f, 3.0f, "");
        PlayGuiSound("react_breath_slow", 0.7f);
    }
    else if(asTimer == "5"){
        StopPlayerLookAt();
        FadeImageTrailTo(0, 1.0f);
        FadePlayerRollTo(0, 33, 33);        // Change all settings to defaults
        FadeSepiaColorTo(0, 4);
        PlayGuiSound("react_breath_slow", 0.5f);
        SetPlayerActive(true);
        SetMessage("Message", "Hint0", 0);
        AddDebugMessage("End Intro", false);
    }
}



RE: Glitchy/Jittery Sleep? - jens - 09-22-2010

Ah sorry read too fast the second part.

Have you tried to disable FadeImageTrailTo in the script? That can look a bit stuttering if having strange values. Maybe lower the values in FadePlayerRollTo? perhaps change 220 to as low as 10 and go from there up.


RE: Glitchy/Jittery Sleep? - theDARKW0LF - 09-22-2010

I'll try that, thanks. - EDIT: Ok so I reduced the 220 to 150 and it works like a charm now, thanks!
Question: Why do most people put in an F after their numerical values in their scripts? I don't and everything seems to still work fine.


RE: Glitchy/Jittery Sleep? - DamnNoHtml - 09-22-2010

I should probably edit that in my post :O

The higher value didn't cause this error for me though, weird.