|
05-21-2013, 11:10 PM | #1 |
Join Date: Mar 2013
Location: England
Posts Rated Helpful 81 Times
|
Help with 'On Player Death' trigger sound
Trying to make it so when player dies a custom sound plays local to death area, tried using input/output system with ambient_generic set to play local to entity ( teamspawn ) and nothing happens, is there a work around in lua for this, a bonus would be different sounds played depending what class dies.
Almost finished my ctf map called Pilkington just need this last bit to work and ready to go, many thanks if anyone can help. |
1 members found this post helpful. |
05-22-2013, 09:06 PM | #2 |
worst ff player eu
Join Date: Jun 2012
Location: South Yorks., England
Class/Position: o - no, d - scout Gametype: IvDZ Posts Rated Helpful 18 Times
|
There will be a way to do this using the base code used in locations (if your map uses locations, it'll be easier to implement), and the function player_killed, but unfortunately I just don't have the time. Sorry. D:
Someone can help you though (prolly squeek knowing just how helpful he always is ;D).
__________________
gg ff not ded ff very much alive |
1 members found this post helpful. |
05-26-2013, 11:41 AM | #3 |
Join Date: Mar 2013
Location: England
Posts Rated Helpful 81 Times
|
No worries, its been a right ball ache, would be nice to have though.
|
|
05-26-2013, 12:59 PM | #4 |
Stuff Do-er
Lua Team
Wiki Team Fortress Forever Staff |
It's possible using Lua for sure.
Either something like (I forget if this works right): Code:
local death_sound = "soundname" -- sounds need to be precached function precache() PrecacheSound( death_sound ) end function player_killed( player, damageinfo ) -- could test various things about the death here -- and then only play the sound depending on certain conditions -- emit sound from the dying player -- EmitSound will play a sound from a sound script -- (you can write a <mapname>_level_sounds.txt -- in the maps folder if you want a custom sound I think, -- see ff_waterpolo_level_sounds.txt) player:EmitSound( death_sound ) end Code:
function player_killed( player, damageinfo ) -- could test various things about the death here -- and then only play the sound depending on certain conditions -- teleport the entity (like an ambient_generic or w/e) -- with the given name to the location of the death -- and then trigger it to play its sound local sound_ent_name = "entity_name" local deathpos = player:GetOrigin() local sound_ent = GetEntityByName( sound_ent_name ) sound_ent:SetOrigin( deathpos.x, deathpos.y, deathpos.z ) OutputEvent(sound_ent_name, "PlaySound") end Both are completely untested.
__________________
#FF.Pickup ¤ Fortress-Forever pickups My Non-official Maps Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic Beta FF_Myth - FF_Redlight_Greenlight Sick of the people on the internet, always moanin'. They just moan. - Karl Pilkington Last edited by squeek.; 05-26-2013 at 01:01 PM. |
|
05-26-2013, 05:38 PM | #5 |
Join Date: Mar 2013
Location: England
Posts Rated Helpful 81 Times
|
Thanks Squeek for info
first one diden't work and 2nd gave me this error in console [SCRIPT] Error calling player_killed ([string "maps\pilkingtonbeta.lua"]:305: attempt to index local 'sound_ent' (a nil value)) ent: NULL also tried level_sounds.txt |
|
05-26-2013, 10:25 PM | #6 |
Stuff Do-er
Lua Team
Wiki Team Fortress Forever Staff |
First one should work.
Here's what I'm using: maps/<mapname>_level_sounds.txt Code:
"customsound.test" { "channel" "CHAN_STATIC" "volume" "1.0" "CompatibilityAttenuation" "0.8" "wave" "player/scream1.wav" } Code:
local death_sound = "customsound.test" -- sounds need to be precached function precache() PrecacheSound( death_sound ) end function player_killed( player, damageinfo ) -- could test various things about the death here -- and then only play the sound depending on certain conditions -- emit sound from the dying player -- EmitSound will play a sound from a sound script -- (you can write a <mapname>_level_sounds.txt -- in the maps folder if you want a custom sound I think, -- see ff_waterpolo_level_sounds.txt) player:EmitSound( death_sound ) end
__________________
#FF.Pickup ¤ Fortress-Forever pickups My Non-official Maps Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic Beta FF_Myth - FF_Redlight_Greenlight Sick of the people on the internet, always moanin'. They just moan. - Karl Pilkington |
1 members found this post helpful. |
Tags |
lua help |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|