Frictional Games Forum (read-only)
Sound playing when reading a note. - 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: Sound playing when reading a note. (/thread-16697.html)



Sound playing when reading a note. - ZyLogicX - 07-02-2012

I have been trying to get examples from the main game, but it doesn't give me any direction where to go.
How would I approach said script?

Solved.


RE: Sound playing when reading a note. - Mackiiboy - 07-02-2012

(07-02-2012, 09:08 PM)ZyLogicX Wrote: I have been trying to get examples from the main game, but it doesn't give me any direction where to go.
How would I approach said script?
.
Select your note in the level editor and open the Entity menu to the right. Put in PickNote_01 at the CallbackFunc-box and save.

[Image: vuIJE.png]

Use this function in your hps script file and choose which music you want to play:

void PickNote_01(string &in entity, string &in type)
{
PlayMusic("nameofyourmusicfile.ogg", false, 0.7f, 0, 10, false);
}


RE: Sound playing when reading a note. - Cruzore - 07-02-2012

That way it does play with you read, but when you close the journal, it still plays. And when you reopen the note, it won't play anymore. That is the closest you can get.
If you want the music to loop when reading the note, but want it to stop when not reading anymore, you could add a script area around where the player could stand(make sure he won't, just around it), add a collide callback inside the function from above, and let that callback function stop the music. Any player would go on after reading it, not just stand there thinking "duh", so that should be a good way of stopping the looping music.
But for the sound/music playing again when reading it a second time, I don't think that's possible