So I've spent my last afternoon making a simple taunt event handler for a custom class for a mod. The sound plays and it works as usual, but the problem is that you can spam the key and the noise overlaps. Naturally, I've looked for a way to fix this and come up with the plan to find a function that can prevent a sound from playing if it is already being played in the same channel, by the player. I've tried for a few hours and never got the S_StartSound function to get to understand the CHANF_NOSTOP flag. Slade3 shows that I need an int type variable....and the only documentation I've found in regards to sound channel flags was about A_StartSound

I'm wondering if there is a way to prevent the sound from being played if the sound is already being played, as to not overlap it, as the game launches with the code below, and there seem to be no changes despite the me changing the flag in various ways, even if I replace it with a number, nothing changes, and I'm starting to ask myself if the flags are supported by this function, and if yes, how? I get no warnings or crashes, and I'm probably missing something here....after spending my time searching for examples of such a simple program, I've stumbled across various syntaxes for the flag, none of which worked. Even posts from 2021 had a syntax that didn't work. I'm surprised, as there have been way worse things to code for this mod, and it wasn't so bad. Anyways, after all this rambling at a late hour I've decided to ask someone about it, so here is the code in my file.
Code: Select all
version "4.11.1"
class my_eventhandler : EventHandler
{
override void NetworkProcess(ConsoleEvent e)
{
if (players[0].mo is "myclass"&& e.Name == "Taunt")
{
S_StartSound("TAUNT0", 2, CHANF_NOSTOP, 1);
}
}
}