How do i play music on a level? - 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: How do i play music on a level? (/thread-10570.html) Pages:
1
2
|
How do i play music on a level? - oscar1007 - 10-03-2011 Yes i have tried many times but it just doens't seem to work. Can someone here please tell me how to script the thing? Thanks! RE: How do i play music on a level? - Tanshaydar - 10-03-2011 void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume); Plays music. asMusicFile - the music to play + extension .ogg abLoop - determines whether a music track should loop afVolume - volume of the music afFadeTime - time in seconds until music reaches full volume alPrio - priority of the music. Note that only the music with the highest priority can be heard! 0 - highest, 1 - lower, etc Simply: PlayMusic("some_music", true or false, any float number, any float number, priority number higher is prior, true or false); For this and more: http://wiki.frictionalgames.com/hpl2/amnesia/script_functions RE: How do i play music on a level? - oscar1007 - 10-03-2011 (10-03-2011, 09:31 AM)Tanshaydar Wrote: void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);I'm kind of new to scripting just so you know. so where do i insert: "void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);" ? If you could display an example of this script that would be great! Sorry to bother you guys with these "noob" problems. like i said before. Im new to this. Thanks again! RE: How do i play music on a level? - Gamemakingdude - 10-03-2011 Do you have a function for when you want to play the music? RE: How do i play music on a level? - Tanshaydar - 10-03-2011 Erm, starting from here will be helpful I think. http://wiki.frictionalgames.com/hpl2/start An example for that could be this: PlayMusic("entranc", true, 1, 5, 1, true); RE: How do i play music on a level? - oscar1007 - 10-03-2011 So if you would type that down below, how would it look? Sorry about the weird insert. im new to this forum. //////////////////////////// // Run first time starting map void OnStart() { } //////////////////////////// // Run when entering map void OnEnter() { } //////////////////////////// // Run when leaving map void OnLeave() { } RE: How do i play music on a level? - oscar1007 - 10-03-2011 someone? RE: How do i play music on a level? - Obliviator27 - 10-03-2011 You would want to put it into your OnStart function. So... void OnStart() { PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume); } RE: How do i play music on a level? - oscar1007 - 10-03-2011 (10-03-2011, 03:40 PM)Obliviator27 Wrote: You would want to put it into your OnStart function. So...Thank you! One more question. how much volume should i set it at? nevermind. i will just try stuff out. RE: How do i play music on a level? - Prelauncher - 10-03-2011 If you want the music to just play in sertain areas in your map, create a script area so when the player enters the music start void OnStart() { AddEntityCollideCallback("Player", "YOURAREA", "MusicControl", false, 0); } void MusicControl(string &in asParent, string &in asChild, int alState) { if(alState == 1) PlayMusic("YOURMUSIC.ogg", true, 1.0f, 5, 0, true); if(alState == -1) StopMusic(3, 0); } |