![]() |
[SCRIPT] Help getting music to play in map - 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] Help getting music to play in map (/thread-29559.html) Pages:
1
2
|
Help getting music to play in map - LDOriginal - 02-01-2015 I've been away from Custom Story'ing a while and just got back to it. I would like music to play in my map when i enter an area. Music that's in the "music" folder in amnesia. I've tried scripting it several times but it's not working. I've allso looked around for a solution but without success. If any of you would please take a look at my script and see were the music code should be put it would be very appreciated! Scripting is hard for the lesser talented... So this is my script: void OnStart() { AddEntityCollideCallback("Player", "Rabarber", "PlaySound", true, 1); AddEntityCollideCallback("Player", "Stopp", "PlaySound", true, 1); AddEntityCollideCallback("Player", "Ljud", "start", true, 1); AddUseItemCallback("", "Key", "Door", "UseKeyOnDoor", true); AddUseItemCallback("", "Nyckel", "Rumpa", "UseKeyOnDoor", true); AddUseItemCallback("", "Tillskåp", "Skåp", "UseKeyOnDoor", true); } void UseKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked(asEntity, false, true); PlaySoundAtEntity("", "Unlock_door.snt", asEntity, 10, false); RemoveItem(asItem); } void start(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "general_piano01.snt", "Player", 0.0f, false); } void PlaySound(string &in asParent, string &in asChild, int alState) { PlaySoundAtEntity("", "21_intro_scream.snt", "Player", 1, false); } All i know is that "void PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);" is to be placed in there in order to work, but i can't figure it out. ![]() ![]() RE: Help getting music to play in map - Neelke - 02-01-2015 If you want music to play, then you need to use PlayMusic script. Code: void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume); But what exactly do you want to be played? RE: Help getting music to play in map - LDOriginal - 02-01-2015 (02-01-2015, 01:57 PM)Neelke Wrote: If you want music to play, then you need to use PlayMusic script. That's not really important right now, i will find something i feel fits, i just don't know how to place the script within my script. :/ I see now i pasted the void PlaySoundAtEntity wich is wrong ofcourse, i meant to say i've tried with the void PlayMusic script. Its just the scripting itself and placements etc that confuces me. RE: Help getting music to play in map - Neelke - 02-01-2015 Well, judging from what I see in the script, it should work. Have you checked if all the names are correct? RE: Help getting music to play in map - LDOriginal - 02-01-2015 (02-01-2015, 02:05 PM)Neelke Wrote: Well, judging from what I see in the script, it should work. Have you checked if all the names are correct? The script as shown there does work. My problem is how and were to apply the void PlayMusic to actually make it work in the map. Perhaps i'm not explaining this to well, sorry. RE: Help getting music to play in map - Darkfire - 02-01-2015 You can also try placing the music file in Custom_Story_Name/music/file.ogg (the format is important, nothing else wil work!) Ps. I wouldn't recommend using native letters like ó, ę, ą ł, or these ones you used. They may work, but they as well might not. RE: Help getting music to play in map - Neelke - 02-01-2015 Your music file needs to be an .ogg format for it to work. There should be some converters online somewhere. RE: Help getting music to play in map - LDOriginal - 02-01-2015 (02-01-2015, 02:18 PM)Neelke Wrote: Your music file needs to be an .ogg format for it to work. There should be some converters online somewhere. Yes i know. My problem is simply how to apply the actual music script within the script. I've tried putting it at the top and bottom but it crashes upon start. RE: Help getting music to play in map - Neelke - 02-01-2015 Grabbing one of your functions here. This is how it's meant to be if you want the music to start when colliding with an area. (I hope I understand you properly.) Code: void start(string &in asParent, string &in asChild, int alState) If you want it to play every time you enter the map: Code: void OnEnter() RE: Help getting music to play in map - LDOriginal - 02-01-2015 (02-01-2015, 02:49 PM)Neelke Wrote: Grabbing one of your functions here. This is how it's meant to be if you want the music to start when colliding with an area. (I hope I understand you properly.) Will try this as soon as i get back home. Thank's for giving the time to help. ![]() |