Frictional Games Forum (read-only)
[SCRIPT] Intro - 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] Intro (/thread-28816.html)



Intro - ethics - 12-31-2014

I need an intro for my custom story.
The Player wakes up and gets off his bed.
It's just an ordinary waking up scene, at first he "lies" on the bed then he slowly gets up (while crouching). After that he moves to the edge of the bed and gets off it. On the floor he should stand again.
I really don't know how to use FadePlayerRollTo and such, never done it.
Can someone help me and figure out proper script?


RE: Intro - Mudbill - 12-31-2014

Pretty sure there is a wakeup script somewhere around here. I see it all the time.

Basically, FadePlayerRollTo will rotate the camera. I believe 0 is normal, 90 is 90 degrees to the right and -90 is 90 degrees to the left, etc. Use that in combination with StartPlayerLookAt so that the head moves how you want it. Just place some "Look" script areas around the bed. Don't forget to time things right with AddTimer.

Use MovePlayerHeadPos to position the camera up and down on the body. I don't really use the X and Z axes for this, but you can. I generally use Y to move the camera down to begin with, then back up once the player stands up.

It takes experimentation and time to get something right. I suggest you try.


RE: Intro - ethics - 12-31-2014

(12-31-2014, 07:52 PM)Mudbill Wrote: Pretty sure there is a wakeup script somewhere around here. I see it all the time.

Basically, FadePlayerRollTo will rotate the camera. I believe 0 is normal, 90 is 90 degrees to the right and -90 is 90 degrees to the left, etc. Use that in combination with StartPlayerLookAt so that the head moves how you want it. Just place some "Look" script areas around the bed. Don't forget to time things right with AddTimer.

Use MovePlayerHeadPos to position the camera up and down on the body. I don't really use the X and Z axes for this, but you can. I generally use Y to move the camera down to begin with, then back up once the player stands up.

It takes experimentation and time to get something right. I suggest you try.

Ok, thank you: Good to see you're still active with Amnesia.

void WakeUp(string &in asTimer)
{
AddLocalVarInt("BlackoutStep", 1);
float fEventSpeed = 0.5f;

switch(GetLocalVarInt("BlackoutStep")) {
case 1:
StartPlayerLookAt("Arealook2", 0.1f, 0.1f, "");
FadeIn(4);
FadeImageTrailTo(2,1);
ShowPlayerCrossHairIcons(false);
SetPlayerMoveSpeedMul(0.05f);
SetPlayerLookSpeedMul(0.05f);
fEventSpeed = 3.0f;
break;
}
if(GetLocalVarInt("BlackoutStep") < 19) AddTimer("blackout", fEventSpeed, "WakeUp");
}

I've seen something like this is a custom story. Can you explain it? It seems really complicated :/


RE: Intro - Radical Batz - 01-01-2015

It's a case time, and what a case timer does it it counts the steps as a timer!
If you don't know what the functions in it are then, float fEventSpeed = 0.5f; is the speed of when the first case will start to function i think.
PHP Code:
StartPlayerLookAt("Arealook2"0.1f0.1f"");
            
FadeIn(4);
            
FadeImageTrailTo(2,1);
            
ShowPlayerCrossHairIcons(false);
            
SetPlayerMoveSpeedMul(0.05f);
            
SetPlayerLookSpeedMul(0.05f);
            
fEventSpeed 3.0f;    
        break; 
Player looks at one area then fades in for 4 seconds, the screen makes an effect and the last 2 lines are the speed of the player's steps.
i really never messed with a case time, but hey I'm getting there...


RE: Intro - Mudbill - 01-01-2015

A switch-statement is like an array of if-statements. They're not very complicated when you know them.

Here's a short example:

PHP Code:
int var = 1;

switch(var) {
    case 
0: {
        
//Run script for case 0.
        
break;
    }
    case 
1: {
        
//Run script for case 1. This one will run because var == 1.
        
break;
    }
    case default: {
        
//Run script if no matching case is found.
        
break;
    }


What happens here is that the switch will use the var variable as its testing value. Depending on the value of var, different cases will run.

The break; keyword is required so that you don't run more than one case. If you do not have break, it will run case 1 and case default after case 0 if 0 was accepted. If 0 was denied, but 1 was accepted (which is the case here), then it will run case 1 and case default (I believe).

If you're more familiar with if-statements, here's an example that does the exact same.

PHP Code:
int var = 1;

if(var == 
0) {
    
//Run script for case 0.
}
else if(var == 
1) {
    
//Run script for case 1. This one will run because var == 1.
}
else if(var < 
|| var > 1) {
    
//Run script if var does not match above. This one runs if var is less than 0 or more than 1, EG anything but the above if-statements.