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
Script Help Intro
ethics Offline
Member

Posts: 51
Threads: 18
Joined: Jan 2014
Reputation: 0
#1
Intro

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?

12-31-2014, 07:45 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Intro

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.

(This post was last modified: 12-31-2014, 07:53 PM by Mudbill.)
12-31-2014, 07:52 PM
Find
ethics Offline
Member

Posts: 51
Threads: 18
Joined: Jan 2014
Reputation: 0
#3
RE: Intro

(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 :/

12-31-2014, 10:41 PM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#4
RE: Intro

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: (Select All)
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...

(This post was last modified: 01-01-2015, 12:05 AM by Radical Batz.)
01-01-2015, 12:03 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#5
RE: Intro

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: (Select All)
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: (Select All)
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.


(This post was last modified: 01-01-2015, 06:25 AM by Mudbill.)
01-01-2015, 06:25 AM
Find




Users browsing this thread: 2 Guest(s)