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 Screen Shake
Alento Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2012
Reputation: 0
#1
Screen Shake

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!

---------Want help with YOUR Custom Story? ---------
http://www.frictionalgames.com/forum/user-19049.html
01-18-2012, 10:03 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: Screen Shake

(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
Find
Alento Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2012
Reputation: 0
#3
RE: Screen Shake

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

---------Want help with YOUR Custom Story? ---------
http://www.frictionalgames.com/forum/user-19049.html
(This post was last modified: 01-18-2012, 10:23 PM by Alento.)
01-18-2012, 10:17 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: Screen Shake

(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
Find
Alento Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2012
Reputation: 0
#5
RE: Screen Shake

(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);
}


---------Want help with YOUR Custom Story? ---------
http://www.frictionalgames.com/forum/user-19049.html
01-18-2012, 10:27 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#6
RE: Screen Shake

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

void OnStart()

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

void THECALLBACKNAME(string &in asParent, string &in asChild, int alState)
{
StartScreenShake(2, 2, 1, 2);
}
Smile

(This post was last modified: 01-18-2012, 10:55 PM by SilentStriker.)
01-18-2012, 10:53 PM
Find
Alento Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2012
Reputation: 0
#7
RE: Screen Shake

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

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



---------Want help with YOUR Custom Story? ---------
http://www.frictionalgames.com/forum/user-19049.html
01-18-2012, 11:04 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#8
RE: Screen 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:

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
Find
Alento Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2012
Reputation: 0
#9
RE: Screen Shake

(01-18-2012, 11:05 PM)SilentStriker Wrote: Have you changed the "THENAMEOFTHEAREA" to the script area?
Yepp Tongue

---------Want help with YOUR Custom Story? ---------
http://www.frictionalgames.com/forum/user-19049.html
01-18-2012, 11:20 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#10
RE: Screen Shake

(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


01-18-2012, 11:35 PM
Find




Users browsing this thread: 1 Guest(s)