Compiling has no errors. But when testing in UT99 the "mutate PlaySounds list" command and the "mutate PlaySounds sound1" command not work.
It seems that the function Mutate is not called.
Shouldn't I use the classname after the mutate command in the console?
Or isn't it right that the function Mutate starts automatically when the class is called via console command?
Code: Select all
class PlaySounds extends Mutator;
#exec AUDIO IMPORT FILE="Sounds\sound1.wav" NAME="sound1" GROUP="CustSounds"
#exec AUDIO IMPORT FILE="Sounds\sound2.wav" NAME="sound2" GROUP="CustSounds"
var string SndStr;
var PlayerPawn SenderPawn;
function Mutate(string MutateString, PlayerPawn Sender)
{
SndStr = caps(MutateString);
SenderPawn = Sender;
if(Left(SndStr, 15) ~= "PLAYSOUNDS LIST")
{
SenderPawn.ClientMessage("Available Sounds:");
SenderPawn.ClientMessage("sound1,sound2");
}
PlaySnd();
if(NextMutator != none)
{
NextMutator.Mutate(MutateString, Sender);
}
}
function PlaySnd()
{
local PlayerPawn PP;
switch SndStr
{
case "PLAYSOUNDS SOUND1":
foreach AllActors( class 'PlayerPawn', PP )
{
PP.ClientPlaySound(Sound'sound1', False);
}
break;
case "PLAYSOUNDS SOUND2":
foreach AllActors( class 'PlayerPawn', PP )
{
PP.ClientPlaySound(Sound'sound2', False);
}
break;
}
}