Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I play a sound when the player dies?
ZyLogicX Offline
Member

Posts: 245
Threads: 24
Joined: May 2011
Reputation: 6
#1
How can I play a sound when the player dies?

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

Beyond the Mountains of Madness [15%]
This forum is dying.
10-16-2011, 01:02 PM
Find
Rapture Offline
Posting Freak

Posts: 1,078
Threads: 79
Joined: May 2011
Reputation: 30
#2
RE: How can I play a sound when the player dies?

I'm not really sure, I will test this out myself later tonight. But looking at the Frictional Wiki. You could
probally use this
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.

10-16-2011, 05:22 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#3
RE: How can I play a sound when the player dies?

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...

(This post was last modified: 10-16-2011, 06:03 PM by Khyrpa.)
10-16-2011, 06:03 PM
Find




Users browsing this thread: 1 Guest(s)