Frictional Games Forum (read-only)
How can I play a sound when the player dies? - 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 can I play a sound when the player dies? (/thread-10797.html)



How can I play a sound when the player dies? - ZyLogicX - 10-16-2011

Basically, when the player dies I want there to be a sound playing... How could I do this?


RE: How can I play a sound when the player dies? - Rapture - 10-16-2011

I'm not really sure, I will test this out myself later tonight. But looking at the Frictional Wiki. You could
probally use this
Code:
float GetPlayerHealth();
with conjunction of a timer that fires every 1 second.
So make a If statement that if the player's health drops below 10 (I think that's the lowest health you could possibly go to if you fall from heights) You would play the sound.




RE: How can I play a sound when the player dies? - Khyrpa - 10-16-2011

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

asCallback - the function to call when the player dies/respawns

Just put the sound inside the callback. I'm not sure but the sound should play right after death, just test if it works like you want...