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



Shaking Room - assassinhawk45 - 01-18-2013

I'm new to Amnesia scripting and I do not know how to make an area shake. I've seen it before in other stories, but I can not figure it out. Another thing that I need help with is making the player lie down. All help would be appreciated.


RE: Shaking Room - Adny - 01-18-2013

void StartScreenShake(float afAmount, float afTime, float afFadeInTime, float afFadeOutTime);

Shakes the screen.

afAmount - intensity of the shake
afTime - duration of the shake
afFadeInTime - time in seconds until full intensity is reached
afFadeOutTime - time until screen is back to normal


RE: Shaking Room - Mackiiboy - 01-18-2013

(01-18-2013, 03:50 PM)assassinhawk45 Wrote: I'm new to Amnesia scripting and I do not know how to make an area shake. I've seen it before in other stories, but I can not figure it out. Another thing that I need help with is making the player lie down. All help would be appreciated.

There is no possible way making the players body to lie down, but it could easily be simulated by changing the players head position in x,y,z and rotate the position ~90 degree so it looks like you are lying down.

I would recommend you making the player crouching and inactive during the event by using:

Code:
SetPlayerActive(false);
SetPlayerCrouching(true);

and then rotate the head by using:

Code:
void FadePlayerRollTo(float afX, float afSpeedMul, float afMaxSpeed);

Rotates the position of the camera on the player's body.

afX - angle of rotation of head, positive being counter-clockwise
afSpeedMul - speed (possibly acceleration) multiplier of the rotation (default 1, which is really slow)
afMaxSpeed - maximum speed of rotation



RE: Shaking Room - assassinhawk45 - 01-18-2013

(01-18-2013, 04:08 PM)Mackiiboy Wrote:
(01-18-2013, 03:50 PM)assassinhawk45 Wrote: I'm new to Amnesia scripting and I do not know how to make an area shake. I've seen it before in other stories, but I can not figure it out. Another thing that I need help with is making the player lie down. All help would be appreciated.

There is no possible way making the players body to lie down, but it could easily be simulated by changing the players head position in x,y,z and rotate the position ~90 degree so it looks like you are lying down.

I would recommend you making the player crouching and inactive during the event by using:

Code:
SetPlayerActive(false);
SetPlayerCrouching(true);

and then rotate the head by using:

Code:
void FadePlayerRollTo(float afX, float afSpeedMul, float afMaxSpeed);

Rotates the position of the camera on the player's body.

afX - angle of rotation of head, positive being counter-clockwise
afSpeedMul - speed (possibly acceleration) multiplier of the rotation (default 1, which is really slow)
afMaxSpeed - maximum speed of rotation

That cannot be correct. I've seen it many scripts, but I can never sort it out from the rest of the script. It's usually in the beginning of the map, where the player is lying on a bed, or something of the sort.


RE: Shaking Room (STILL NEED HELP!) - NaxEla - 01-18-2013

Mackiiboy is completely correct. People use the functions FadePlayerRollTo and MovePlayerHeadPos to simulate lying down.


RE: Shaking Room (STILL NEED HELP!) - assassinhawk45 - 01-18-2013

The shaking script isn't working.
////////////////////////////
// Run when starting map
void OnStart()
{
SetEntityConnectionStateChangeCallback("lever", "func_shelf");
SetEntityConnectionStateChangeCallback("lever_1", "StartScreenShake");
}


void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetEntityActive("fail_1", true);
}
}


void StartScreenShake(float 5.0f, float 10.0f, float 5.0f, float 5.0f);
{
SetEntityActive("bridge", true);
}
It says unexpected token { (20,1)

(01-18-2013, 05:34 PM)NaxEla Wrote: Mackiiboy is completely correct. People use the functions FadePlayerRollTo and MovePlayerHeadPos to simulate lying down.

Ok


RE: Shaking Room (STILL NEED HELP!) - The chaser - 01-18-2013

What are you exactly trying to do? You can't put

void StartScreenShake(float 5.0f, float 10.0f, float 5.0f, float 5.0f);

Anywhere. It should be:

void OnStart()

{

SetEntityConnectionStateChangeCallback("lever", "func_shelf");

SetEntityConnectionStateChangeCallback("lever_1", "StartScreenShake");

}





void func_shelf(string &in asEntity, int alState)

{

if (alState == 1)

{

SetEntityActive("fail_1", true);

}

}





void StartScreenShake(string &in asEntity, int alState)

{

SetEntityActive("bridge", true);
StartScreenShake(5.0f, 10.0f, 5.0f, 5.0f);

}


RE: Shaking Room (STILL NEED HELP!) - assassinhawk45 - 01-18-2013

Wow, I'm stupid. Sorry about bothering you all. I extremely new to this


RE: Shaking Room (STILL NEED HELP!) - The chaser - 01-18-2013

(01-18-2013, 06:47 PM)assassinhawk45 Wrote: Wow, I'm stupid. Sorry about bothering you all. I extremely new to this

Lol take your time, everyone here was a noob once. Even me Wink