Custom sound files when interacting with objects... - 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: Custom sound files when interacting with objects... (/thread-10413.html) |
Custom sound files when interacting with objects... - ZyLogicX - 09-20-2011 I have this awesome Idea for my conversion mod. But I dont know how I should appraoch it. Basically, I want the player to say things when interacting with objects... so like when you pick up a broom, the audio file starts and says 'I dont know how that is going to work' Is it possible for me to do, and How? RE: Custom sound files when interacting with objects... - Obliviator27 - 09-20-2011 (09-20-2011, 04:30 PM)ZyLogicX Wrote: I have this awesome Idea for my conversion mod. But I dont know how I should appraoch it.You're going to have to add a PlayerInteract callback (which can be made directly from the level editor) that calls a PlaySoundAtEntity function. Example: void PlayBroomPickup(string &in asEntity) { PlaySoundAtEntity("", "[customsound + .snt extension]", "Player", 0, false); } Making sure that you have PlayBroomPickup as your item interact callback in the level editor. If you want this to happen every time you pick up the broom, don't have "callbackautoremove" checked in the editor. Hopefully this solves your problem. RE: Custom sound files when interacting with objects... - Pr3d4t0r - 09-20-2011 Oliviator, please can you help me too please because you're here ? How can I put custom music (ambient) to my CS ? I made a music, exported it in *.ogg and I copied a snt file from the game and changed its parameters for my sound, but when I play it in the editor, it doesn't play anything... doesn't play in game neither ! Can you help me ? thanks ^^ RE: Custom sound files when interacting with objects... - Obliviator27 - 09-20-2011 Sure thing! Ambient music is really quite simple to implement. You don't need a .snt file for ambient music. All you need is the .ogg. Then, in your OnStart function, add Playmusic. Example void OnStart() { PlayMusic ("[musicname + .ogg extension]", [true or false if you want it to loop], [A decimal for volume. Usually below 1, but above 0], [time until music reaches full volume], [Priority of music. Zero is highest priority], [true or false if you want it to resume if it gets interrupted (i.e, monster attack)]); } Taken from: 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 And have the music.ogg file in a sounds folder in your main directory for your custom story Feel free to PM me with any more questions you may have. RE: Custom sound files when interacting with objects... - Pr3d4t0r - 09-20-2011 Thank you very much ! But when will the sound start with these lines ? At the beginning of the map ? Because I just want to implement a music in the beginning of the map, wich is looped BUT only in a certain area ! Something like when you get out of the room, you can't hear the music anymore but when you come back into this room, you can hear this music again. There is my new code : Code: void OnStart() Now it works in game thank you !! I added a sound entity with my ogg.file in the area where i want my sound to play. But if I leave this area, will the music stop ? RE: Custom sound files when interacting with objects... - Obliviator27 - 09-20-2011 (09-20-2011, 06:23 PM)Pr3d4t0r Wrote: Thank you very much ! But when will the sound start with these lines ? At the beginning of the map ? Because I just want to implement a music in the beginning of the map, wich is looped BUT only in a certain area ! Something like when you get out of the room, you can't hear the music anymore but when you come back into this room, you can hear this music again.If I understand your question correctly, the sounds will play over top of the ambient music. And I can't think of any special way of playing the music in a certain room. All I can think of would be to have an area on each side of the door, and corresponding collidecallbacks. In the one outside the room, you use a StopMusic function (on the wiki) and in the one for inside, PlayMusic. Just don't autodelete the collide callback, and it should work fine. There's probably a better way to do this, but it's all I can think of at the moment. RE: Custom sound files when interacting with objects... - ZyLogicX - 09-20-2011 Thank you Obliviator27... I got it working, thanks RE: Custom sound files when interacting with objects... - Pr3d4t0r - 09-21-2011 Thank you Obliviator for your help |