Frictional Games Forum (read-only)
[SCRIPT] How to create a music area trigger? - 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: [SCRIPT] How to create a music area trigger? (/thread-12243.html)



How to create a music area trigger? - Viuffuz - 01-01-2012

Hello there! I'm new with scripting and I need help with creating an area that makes music start playing when player walks in that area. I've tried a few things but with no results. Thank you for your time!



RE: How to create a music area trigger? - Dobbydoo - 01-01-2012

You just need to have a script area, and script a collidecallback with it. Then use the PlayMusic function to start the music when you collide with the script area.



RE: How to create a music area trigger? - Viuffuz - 01-01-2012

Can you give me an example of a working one please? Big Grin



RE: How to create a music area trigger? - flamez3 - 01-01-2012

Quote:void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea1", "MusicPlay", true, 1);

}

void MusicPlay(string &in asParent, string &in asChild, int alState)
PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
}



RE: How to create a music area trigger? - Viuffuz - 01-01-2012

Oh yeah! Big Grin Thank you really much!!! ^^