Frictional Games Forum (read-only)
script - 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: script (/thread-9493.html)



script - zecuro - 07-30-2011

just wondering if its possible to make a script that you start layin on your back and it looked like you just woke up like eye blink and then ou start raising up and then sit on the side of the bed and then stand up....welll that about it it would be perfect for my story....or if it not possible then something a like will be awesome


sorry for my bad english[/font]


RE: script - Kyle - 07-30-2011

It's very much possible.

Simply have the player crouched and then change player head position to be looking up either 2 ways. I'll attempt making a script that has something like this.

Code:
void OnStart()
{
     FadeOut(0);
     FadeIn(5);
     SetPlayerActive(false);
     SetPlayerCrouching(true);
     SetInventoryDisabled(true);
     StartPlayerLookAt("ScriptArea_1", 10, 10, "");
     AddTimer("T1", 5.5, "TimerFunc");
     AddTimer("T2", 10, "TimerFunc");
     AddTimer("T3", 13.5, "TimerFunc");
     AddTimer("T4", 16, "TimerFunc");
}
void TimerFunc(string &in asTimer)
{
     string x = asTimer;
     if (x == "T1")
     {
          FadeOut(4);
          PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
     }
     else if (x == "T2")
     {
          FadeIn(3);
     }
     else if (x == "T3")
     {
          FadeOut(2);
          StopPlayerLookAt();
          PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
     }
     else if (x == "T4")
     {
          FadeIn(2);
          SetPlayerActive(true);
          SetPlayerCrouching(false);
          SetInventoryDisabled(false);
          PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
     }
}

That should do it, but in case it doesn't work exactly the way you want it to, it may be possible to do it another way. Wink


RE: script - zecuro - 07-30-2011

(07-30-2011, 08:12 PM)Kyle Wrote: It's very much possible.

Simply have the player crouched and then change player head position to be looking up either 2 ways. I'll attempt making a script that has something like this.

Code:
void OnStart()
{
     FadeOut(0);
     FadeIn(5);
     SetPlayerActive(false);
     SetPlayerCrouching(true);
     SetInventoryDisabled(true);
     StartPlayerLookAt("ScriptArea_1", 10, 10, "");
     AddTimer("T1", 5.5, "TimerFunc");
     AddTimer("T2", 10, "TimerFunc");
     AddTimer("T3", 13.5, "TimerFunc");
     AddTimer("T4", 16, "TimerFunc");
}
void TimerFunc(string &in asTimer)
{
     string x = asTimer;
     if (x == "T1")
     {
          FadeOut(4);
          PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
     }
     else if (x == "T2")
     {
          FadeIn(3);
     }
     else if (x == "T3")
     {
          FadeOut(2);
          StopPlayerLookAt();
          PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
     }
     else if (x == "T4")
     {
          FadeIn(2);
          SetPlayerActive(true);
          SetPlayerCrouching(false);
          SetInventoryDisabled(false);
          PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
     }
}

That should do it, but in case it doesn't work exactly the way you want it to, it may be possible to do it another way. Wink

the script work fine but how do i fix my player start script like if it was layin on hes back cuz now he look like he crouching in the bed and sleeping stand ding up lolll


RE: script - Kyle - 07-30-2011

And that leads to the 2nd way to do it. I'll have to combine both of them for it to work. Try this:

Code:
void OnStart()
{
     FadeOut(0);
     FadeIn(5);
     SetPlayerActive(false);
     SetPlayerCrouching(true);
     SetInventoryDisabled(true);
     MovePlayerHeadPos(0, -2, 0, 2, -2);
     StartPlayerLookAt("ScriptArea_1", 10, 10, "");
     AddTimer("T1", 5.5, "TimerFunc");
     AddTimer("T2", 10, "TimerFunc");
     AddTimer("T3", 13.5, "TimerFunc");
     AddTimer("T4", 16, "TimerFunc");
}
void TimerFunc(string &in asTimer)
{
     string x = asTimer;
     if (x == "T1")
     {
          FadeOut(4);
          PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
     }
     else if (x == "T2")
     {
          FadeIn(3);
     }
     else if (x == "T3")
     {
          FadeOut(2);
          StopPlayerLookAt();
          PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
          MovePlayerHeadPos(0, 2, 0, 2, 2);
     }
     else if (x == "T4")
     {
          FadeIn(2);
          SetPlayerActive(true);
          SetPlayerCrouching(false);
          SetInventoryDisabled(false);
          PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
     }
}

I'm not sure if the numbers would make the correct effect work correctly, but I do know that it will do something. ^^