Frictional Games Forum (read-only)
Need help with script - 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: Need help with script (/thread-19701.html)



Need help with script - Slanderous - 12-27-2012

Hey everyone.

Can someone explain me, how to make the game play the sound, when player walks into area?

Thanks.

btw - sorry for my bad eng.


RE: Need help with script - Traggey - 12-27-2012

Moved to development support.


RE: Need help with script - CptLogicDev - 12-27-2012

(12-27-2012, 04:59 PM)lazz3r Wrote: Hey everyone.

Can someone explain me, how to make the game play the sound, when player walks into area?

Thanks.

btw - sorry for my bad eng.

Code:
PlaySoundAtEntity("", "sound file with snt", "what entity the sound plays on", i use 1 often, save the sound true or false);

:)



RE: Need help with script - Adrianis - 12-28-2012

In addition to what CptLogicDev said, since you want the sound to play when the player enters an area...

You need AddEntityCollideCallback in OnStart, like this

void OnStart()
{
AddEntityCollideCallback("Player", "YOUR AREA NAME HERE", "PlaySound", true, 1);
}

void PlaySound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "sound file with snt", "what entity the sound plays on", i use 1 often, save the sound true or false);
}

It's all in here... http://wiki.frictionalgames.com/hpl2/amnesia/script_functions


RE: Need help with script - Slanderous - 12-29-2012

Thanks for help.