Frictional Games Forum (read-only)
[SCRIPT] Restart custom music after respawn? - 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] Restart custom music after respawn? (/thread-21849.html)



Restart custom music after respawn? - serbusfish - 06-17-2013

In several sections of my CS I use alternative music to replace regular monster music. However ive found that if you die and respawn the music stops and the normal music plays. Is there a way to make my custom music restart playing after you die?


RE: Restart custom music after respawn? - Adrianis - 06-17-2013

(06-17-2013, 12:23 AM)serbusfish Wrote: In several sections of my CS I use alternative music to replace regular monster music. However ive found that if you die and respawn the music stops and the normal music plays. Is there a way to make my custom music restart playing after you die?

Code:
void CheckPoint (string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry);

Sets a checkpoint at which the player will respawn in case he dies.
Callback syntax: void MyFunc(string &in asName, int alCount)
Count is 0 on the first checkpoint load!

asName - the internal name
asStartPos - the name of the StartPos in the editor
asCallback - the function to call when the player dies/respawns
asDeathHintCat - the category of the death hint message to be used in the .lang file
asDeathHintEntry - the entry in the .lang file

Using this CheckPoint function, you can define a function that will be called when the player respawns (check the asCallback line)
Theoretically you should be able to use 'PlayMusic' in the callback function to start playing music of your choice when they respawn, but it almost certainly won't be a seamless transition for the music playing before you die, then after you respawn. You'll have to try it and find out