Jump to content
Sign in to follow this  
Kydoimos

Help with EventHandler

Recommended Posts

I'm trying to create a camera shake effect when the player is close to a destroyed helicopter:

_Helicopter addEventHandler [

"Killed",

{

// Only shake the camera if appropriate

if Player distance _Helicopter < 40 then {

addCamShake [10, 0.8, 20];

};

}

];

I've defined _Helicopter. Any ideas where I've gone wrong? Thanks for any help / suggestions!

Share this post


Link to post
Share on other sites
I'm trying to create a camera shake effect when the player is close to a destroyed helicopter:

_Helicopter addEventHandler [

"Killed",

{

// Only shake the camera if appropriate

if (Player distance _Helicopter < 40) then {

addCamShake [10, 0.8, 20];

};

}

];

I've defined _Helicopter. Any ideas where I've gone wrong? Thanks for any help / suggestions!

5char

Share this post


Link to post
Share on other sites

I'm not sure, but does addCamShake not need a unit to be applyed?

Like:

player addCamShake [10, 0.8, 20];

Share this post


Link to post
Share on other sites

You're right, it doesn't. It applies to the camera, not a unit.

Share this post


Link to post
Share on other sites

Ok, was not sure because the wiki is still down and i was not able to check it...

Share this post


Link to post
Share on other sites

Hi all - thanks for your suggestions! I tried it with brackets but still didn't have any luck. But then I started thinking, could it be because the event handler 'KILLED' is applied to an empty Helicopter? Maybe it doesn't count as 'KILLED'?

Share this post


Link to post
Share on other sites

you can't use _Helicopter as it's seen as local variable even though it's a name, remove the underscore or use (_this select 0) inside the EVH

Share this post


Link to post
Share on other sites

Interesting! Ok, I'll endeavour to give that a go. Cheers,

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×