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
Help needed with "Intro script"
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#1
Help needed with "Intro script"

Hello again so I'm working my next project but, how I can do this in script?

"Wake up normally style i know that then player moving slowly starting hallway then it falls down to the ground and get blackout or something then he teleports and...
then he wakes up again normally?

Help is appreciated thanks.

- Scripting noob -.-

“Life is a game, play it”
(This post was last modified: 07-16-2011, 11:34 PM by HumiliatioN.)
07-16-2011, 11:34 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: Help needed with "Intro script"

Use these functions to make the player seem dazed/injured etc:

Teleport the Player to a PlayerStart area:
TeleportPlayer(string areaname);

Tilted/lowered head:
FadePlayerRollTo(float X, float speed, float maxspeed);
MovePlayerHeadPos(float x, float y, float z, float speed, float slowdowndist);

Move/Look speed multipliers:
SetPlayerMoveSpeedMul(float multiplier);
SetPlayerRunSpeedMul(float multiplier);
SetPlayerLookSpeed(float multiplier);

Image effects:
FadeImageTrailTo(float amount, float speed);
FadeSepiaColorTo(float amount, float speed);


Amnesia's faint sequences in the beginning use the head position/tilt controllers. You can script blackouts with FadeOut(float time); and FadeIn(float time);

Use a good combination of these functions using a switch function, which lets you tightly control the sequence without having to use multiple functions (like FunctionOne doing the blackout while FunctionTwo does the sound effects)

Here's a good example of an event switch function:

void SwitchFuncScaryEvent(string &in timer) {
    switch(GetLocalVarInt("eventStep")) {
        case 1:
            //Player sees something scary happen!
            AddTimer("nextstep", 1, "SwitchFuncScaryEvent");
        break;
        case 2:
            //Player reacts to said scary thing!
            AddTimer("nextstep", 1, "SwitchFuncScaryEvent");
        break;
        case 3:
            //Another part of the event happens, even more scary stuff!
            AddTimer("nextstep", 1, "SwitchFuncScaryEvent");
        break;
        case 4:
            //Player falls down and gasps!
            AddTimer("nextstep", 1, "SwitchFuncScaryEvent");
        break;
        case 5:
            //Player blacks out!
            AddTimer("nextstep", 1, "SwitchFuncScaryEvent");
        break;
    }
    
    AddLocalVarInt("eventstep", 1);
}
You can control the time between each step in the function by editing the timer duration in the step before it. This is how FG did their events, and boy did they do it well. With some practice you can make really convincing and detailed events using one or perhaps two functions!

(This post was last modified: 07-17-2011, 09:24 AM by palistov.)
07-17-2011, 09:22 AM
Find
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#3
RE: Help needed with "Intro script"

(07-17-2011, 09:22 AM)palistov Wrote: Use these functions to make the player seem dazed/injured etc:

Teleport the Player to a PlayerStart area:
TeleportPlayer(string areaname);

Tilted/lowered head:
FadePlayerRollTo(float X, float speed, float maxspeed);
MovePlayerHeadPos(float x, float y, float z, float speed, float slowdowndist);

Move/Look speed multipliers:
SetPlayerMoveSpeedMul(float multiplier);
SetPlayerRunSpeedMul(float multiplier);
SetPlayerLookSpeed(float multiplier);

Image effects:
FadeImageTrailTo(float amount, float speed);
FadeSepiaColorTo(float amount, float speed);


Amnesia's faint sequences in the beginning use the head position/tilt controllers. You can script blackouts with FadeOut(float time); and FadeIn(float time);

Use a good combination of these functions using a switch function, which lets you tightly control the sequence without having to use multiple functions (like FunctionOne doing the blackout while FunctionTwo does the sound effects)

Here's a good example of an event switch function:

void SwitchFuncScaryEvent(string &in timer) {
    switch(GetLocalVarInt("eventStep")) {
        case 1:
            //Player sees something scary happen!
            AddTimer("nextstep", 1, "SwitchFuncScaryEvent");
        break;
        case 2:
            //Player reacts to said scary thing!
            AddTimer("nextstep", 1, "SwitchFuncScaryEvent");
        break;
        case 3:
            //Another part of the event happens, even more scary stuff!
            AddTimer("nextstep", 1, "SwitchFuncScaryEvent");
        break;
        case 4:
            //Player falls down and gasps!
            AddTimer("nextstep", 1, "SwitchFuncScaryEvent");
        break;
        case 5:
            //Player blacks out!
            AddTimer("nextstep", 1, "SwitchFuncScaryEvent");
        break;
    }
    
    AddLocalVarInt("eventstep", 1);
}
You can control the time between each step in the function by editing the timer duration in the step before it. This is how FG did their events, and boy did they do it well. With some practice you can make really convincing and detailed events using one or perhaps two functions!


Okay begin was good but he teleports "Player doesn't fall down he automatic teleport and then he rotates he's head 90 degrees right then later he is normally state. and i can move... its stupid how i can make it more realistic I dont understand that Scaryevent advanced timer thing.


“Life is a game, play it”
(This post was last modified: 07-17-2011, 07:21 PM by HumiliatioN.)
07-17-2011, 07:20 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#4
RE: Help needed with "Intro script"

I'm not sure if there was a question in your reply haha. OK well to stop the player from moving use SetPlayerActive(false);

Make sure you use SetPlayerActive(true); later so the player can move again Tongue

The switch function isn't too hard to understand once you get the hang of it. Think of it like a music playlist. The first song (case 1) plays first, then the timer calls the function again and this time it plays the second song (case 2), and it keeps going until there are no more songs (no more cases!).

You need to use those functions I posted above in a switch function to efficiently make a faint/wake up sequence. Just practice. Smile

07-17-2011, 07:38 PM
Find
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#5
RE: Help needed with "Intro script"

(07-17-2011, 07:38 PM)palistov Wrote: I'm not sure if there was a question in your reply haha. OK well to stop the player from moving use SetPlayerActive(false);

Make sure you use SetPlayerActive(true); later so the player can move again Tongue

The switch function isn't too hard to understand once you get the hang of it. Think of it like a music playlist. The first song (case 1) plays first, then the timer calls the function again and this time it plays the second song (case 2), and it keeps going until there are no more songs (no more cases!).

You need to use those functions I posted above in a switch function to efficiently make a faint/wake up sequence. Just practice. Smile

Oh now i have it thanks. But i have this script but why player is still 90 degrees.. all the time no stops after that teleport.

Whole script just in case:

void OnStart()

{
// AddEntityCollideBacks
AddEntityCollideCallback("Player", "Felldown", "Teleport1", true, 1);










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);
FadeSepiaColorTo(0.5f, 0.5f);
FadeRadialBlurTo(0.7f, 0.5f);
FadePlayerRollTo(0, 33, 33); // Change all settings to defaults
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
SetPlayerMoveSpeedMul(0.2);
PlayMusic("29_amb_end_daniel", false, 3, 3, 10, true);
}






void OnEnter()
{
}


// Functions
void Teleport1(string &in asParent, string &in asChild, int alState)
{
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(100, 4);
SetPlayerActive(false);
FadePlayerRollTo(80.0f, 80.0f, 100.0f);
FadeOut(0.45f);
GiveSanityDamage(100, true);
AddTimer("tele", 3, "Teleport");
}

void Teleport(string &in asTimer)
{
TeleportPlayer("PlayerStartArea_2");
AddTimer("trig1", 8.0f, "beginStory2");
}

void beginStory2(string &in asTimer){
FadeIn(3);
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
PlayMusic("16_amb", false, 3, 3, 10, true);
}








void OnLeave()
{
}

EDIT: Nothing I solved it ! Thanks for your help!

“Life is a game, play it”
(This post was last modified: 07-17-2011, 08:13 PM by HumiliatioN.)
07-17-2011, 07:46 PM
Find




Users browsing this thread: 1 Guest(s)