How can I modify the TTT Death Sound for the ONLY the person who died?

Alright, so the last question I asked on this site was only maybe 2 days ago, so I feel really bad and helpless at this point.

So, here’s the deal:
I have a TTT dedicated Gmod server, and I want to edit the sound that plays when somebody dies. I’ve looked around a bit, and unfortunately, though there are similar mods, none of them do quite what my picky mind wants. (It seems I always want odd things…)

Most mods edit the sound someone makes when they die. You know, the scream that everybody hears. However, I do not want to edit this file as I still think it’s important for other players who recognise it, and also the files I want to add are perhaps a little too lengthy and not quite screamy enough. My main issue is that these files are heard by everybody - everybody close to the scream hears the scream. It’s rather simple.

I do not want this. I would like to add a sound to play for only the person who died when they died. So, people around them still hear the scream, and nobody around them hears the new Death Sound. Instead, it is only the person who died who can hear the Death Sound. The actual Death Sound (the selection of screams) should still remain for others to hear and be un-tampered with.

How may I do this? I know very little Lua coding and have very little experience in actuality with modding Gmod servers (My server only has about 100 or so addons, so I’m not too experienced) so if you are to explain it; treat me like a baby who can’t speak English.

Also, the following are preferences I would like, but are just silly preferences that, if not fulfilled, I couldn’t care less: I would like it to randomly pick from a selection of different death sounds, I would like the death sound to not play if it is the last person to die (I.E. Not clashing with the end of the round, as I already have end-round music.) and I would also like the normal Death Sound scream to be muted for the person dying, and so they only hear the Death Sound that only they can hear.

If you help me in any way, thank you so much in advanced. If you didn’t help, thank you for taking the time to read this request anyway. Thank you so much!


I don’t really have time to actually write this, but here’s the actual death sound code in the TTT source

You’ll need to overwrite that function in your own lua file. Just make a function that’s called and formatted exactly the same as that one with different contents and it should replace it

What you probably want to do is check clientside if the victim == LocalPlayer() AKA if the person who died was you then modify the sound that plays accordingly.

If you look above that function call to here

You can see the table they have of the death sounds. Do a little bit of human-brand pattern recognition to create your own table of alternate sounds that you want to play and use those when that clientside check comes true.

That might not be quite the right recipe to make it work, but that’s probably going to be the core of it

edit: Bad luck it looks like that’s a local function and you’re actually going to need to replace both that function and this larger, scarier function