Game Development Community

Player.playAudio upon death how to

by Michael S · in Torque 3D Professional · 03/24/2012 (5:14 pm) · 5 replies

Hello everyone, a while back I asked for someone to teach me torque script, well i was told that its highly unlikely, so I decided to pick up on the learning process myself, now its been going good, however I will be posting here for small things, and sometimes big things I could use some help with. Right now, its not that big a deal. I just want to know how to load up some audio when a player dies, I am working on health right now, just started today. So, if someone could help out, it would be a great help, thanks!

#1
03/24/2012 (6:52 pm)
It's actually in stock T3D to have the player scream on heavy damage or death.
Check the functions in scripts/server/player.cs:
Armor::onDisabled()//dead
Armor::onDamage()//hurt
They both call a different function to play a "groan" sound.
#2
03/24/2012 (7:03 pm)
Ahh, I see why I didn't know that, I started an empty project, let me just remake to check this out.
#3
03/25/2012 (10:00 am)
see this.those explenation will help u.
http://www.garagegames.com/community/resources/view/19869
#4
03/25/2012 (11:01 am)
Steve nailed where to find it -- just remember that the Full Template (or other Example Projects) is more fleshed out than the Empty Template. The Resource which Ahsan linked to will extend the default death/pain sounds to allow different ones per player/ai.

The calls to playPain() and playDeathCry() each reach out to a Player namespace method that in turn will call playAudio()

Another way to see how to do something similar is to take note of serverPlayer3D(%sfxProfileToPlay, %transform) which will allow you to play a named SFXProfile at a given object's location.
#5
03/26/2012 (8:18 am)
Thanks for the replies, I think I got it now. :)