Frictional Games Forum (read-only)

Full Version: Screen Shake
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hello everyone!

I just started to do this. And i must say, it is sooo much fun! Big Grin

BUT!

I'm stuck.. I wanna do a screen shake when the player is in my "HangArea". Because when the
player is in the "HangArea", there is a corpse, hanging upside down, popping up .
I've looked around the forums for something similar.
But i don't still don't get it, how the script is supposed to look like.


Please help me someone! It would be so appreciated!


Thanks!
(01-18-2012, 10:03 PM)Alento Wrote: [ -> ]Hello everyone!

I just started to do this. And i must say, it is sooo much fun! Big Grin

BUT!

I'm stuck.. I wanna do a screen shake when the player is in my "HangArea". Because when the
player is in the "HangArea", there is a corpse, hanging upside down, popping up .
I've looked around the forums for something similar.
But i don't still don't get it, how the script is supposed to look like.

Please help me someone! It would be so appreciated!

Thanks!
Use this code Smile

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


(01-18-2012, 10:15 PM)SilentStriker Wrote: [ -> ]
(01-18-2012, 10:03 PM)Alento Wrote: [ -> ]
Use this code Smile

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
hm.. i just got error message :/


Don't i need a collide or something? Tongue

Cuz i just got error message saying that "it's an unexpected '{'

hmm :/
(01-18-2012, 10:17 PM)Alento Wrote: [ -> ]oh! so it is just that void? :O

Thank you! Big Grin
If you want it to start shake when the player walks in to an area you need to make a collidecallback and then use the use screenshake without the void inside the callback Smile You get it or are you very new at scripting and don't know anything? Smile
(01-18-2012, 10:20 PM)SilentStriker Wrote: [ -> ]If you want it to start shake when the player walks in to an area you need to make a collidecallback and then use the use screenshake without the void inside the callback Smile You get it or are you very new at scripting and don't know anything? Smile
haha well ya, with that said.. i started scripting like.. 2 days ago ^^
So, yeah, i'm a bit retarded on this Tongue i try as hard as i can ^^

but i really don't get it. i mean

this is what my script to shake looks like now:

void OnStart()

{

AddEntityCollideCallback("hangman", "HangArea", "StartScreenShake", true, 1);
}

void StartScreenShake(float afAmount, float afTime, float afFadeInTime, float afFadeOutTime);
{
StartScreenShake(3.0f, 2.3f, 0.0f, 0.0f);
}

(01-18-2012, 10:27 PM)Alento Wrote: [ -> ]
(01-18-2012, 10:20 PM)SilentStriker Wrote: [ -> ]If you want it to start shake when the player walks in to an area you need to make a collidecallback and then use the use screenshake without the void inside the callback Smile You get it or are you very new at scripting and don't know anything? Smile
haha well ya, with that said.. i started scripting like.. 2 days ago ^^
So, yeah, i'm a bit retarded on this Tongue i try as hard as i can ^^

but i really don't get it. i mean

this is what my script to shake looks like now:

void OnStart()

{

AddEntityCollideCallback("hangman", "HangArea", "StartScreenShake", true, 1);
}

void StartScreenShake(float afAmount, float afTime, float afFadeInTime, float afFadeOutTime);
{
StartScreenShake(3.0f, 2.3f, 0.0f, 0.0f);
}
Remember that when making a callback you need to use the right callback syntaxes so it should look like:

Code:
void OnStart()

{
AddEntityCollideCallback("Player", "THENAMEOFTHEAREA", "THECALLBACKNAME", true, 1);
}

void THECALLBACKNAME(string &in asParent, string &in asChild, int alState)
{
StartScreenShake(2, 2, 1, 2);
}
Smile
(01-18-2012, 10:53 PM)SilentStriker Wrote: [ -> ]Remember that when making a callback you need to use the right callback syntaxes so it should look like:

Code:
void OnStart()

{
AddEntityCollideCallback("Player", "THENAMEOFTHEAREA", "THECALLBACKNAME", true, 1);
}

void THECALLBACKNAME(string &in asParent, string &in asChild, int alState)
{
StartScreenShake(2, 2, 1, 2);
}
Smile
Thank you, but, actually, it doesn't shake at all :/ no error messages this time, but no shake :/


(01-18-2012, 11:04 PM)Alento Wrote: [ -> ]
(01-18-2012, 10:53 PM)SilentStriker Wrote: [ -> ]Remember that when making a callback you need to use the right callback syntaxes so it should look like:

Code:
void OnStart()

{
AddEntityCollideCallback("Player", "THENAMEOFTHEAREA", "THECALLBACKNAME", true, 1);
}

void THECALLBACKNAME(string &in asParent, string &in asChild, int alState)
{
StartScreenShake(2, 2, 1, 2);
}
Smile
Thank you, but, actually, it doesn't shake at all :/ no error messages this time, but no shake :/
Have you changed the "THENAMEOFTHEAREA" to the script area?


(01-18-2012, 11:05 PM)SilentStriker Wrote: [ -> ]Have you changed the "THENAMEOFTHEAREA" to the script area?
Yepp Tongue
(01-18-2012, 11:20 PM)Alento Wrote: [ -> ]
(01-18-2012, 11:05 PM)SilentStriker Wrote: [ -> ]Have you changed the "THENAMEOFTHEAREA" to the script area?
Yepp Tongue
True change the 1 to a 0 on AddEntityCollideCallback Smile

Pages: 1 2 3