• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Footstep sound muted

Youg

Grizzled Veteran
Jan 19, 2013
60
0
So I'm looking at adding the ability to mute the footstep sounds from playing in my mutator preferably. I was going with just this:

Code:
MyPawn.SprintFootStepVolume = 0.0 etc

This is located within a tick event though appears not to actually set the volume level to 0.0, or do anything really. I need the ability to set it higher as well as mute it, though the muting is the more important at this current time.

Any direction would be much appreciated as I can't think of any other way to really achieve this other than altering the sound file directly on each machine.
 
So I've been doing more poking around and still can't find a solution.

I tried telling the game not to play a sound by using an If(sound is playing()) stop sound, which gave me an error. I wasn't expecting it to work, but thought I could try and get into the simulated event PlayFootStepSound(int FootDown) inside the ROPawn file in the steam dir. But I get an error. I'm currently trying to get into the event by doing:

Code:
if(MyPawn.PlayFootStepSound())

But do I need to be going at this in its own function inside my mutator? So:

Code:
end of previous function }
simulated event PlayFootStepSound(int FootDown) etc..

Inside the PlayFoot event sets all the FootStepVolumes for each instance before selecting which sound to play, now aside from going into each LAN machine's ROPawn class and changing these volume values manually I have no clue on what to look at next.
 
Upvote 0
Hmm, didn't occur to me that it has potential cheating qualities... But no its not, its to see if players react to the sound of approaching footsteps more than currently thought. This research is into subtle sounds and how players react to those sounds, so making them more obvious or silent is a big part of this.

Thanks Ducky for the pointer! Now have a good idea on how to implement this, though would this require another mutator or would I just call it with the other one in the SprintMutator extends mutator class? So:

Code:
    if (ROGameInfo(self.WorldInfo.Game) != None)
    {
        // This tells UE to use the ROSprintController class, going through the mutator to implement it like a mod
        ROGameInfo(self.WorldInfo.Game).PlayerControllerClass = class'sprintMutator.ROSprintController';
[COLOR=yellow]ROGameInfo(Self.WorldInfo.Game).ROPawnClass = class'sprintMutator.ROFootStepController';[/COLOR]
    }
 
Last edited:
Upvote 0
Just occured to me, would I be looking and putting these values in a tick event within the new class? Here's what I've got currently for the new class, though I'm not sure if it works yet.

Code:
class ROFootStepController extends ROPawn;
function PostBeginPlay()
{
 super.PostBeginPlay();
}
function StepVolumes (Pawn Other);
{
 local ROPawn MyPawn;
 MyPawn = ROPawn (Other);
 
 //sets the footstep volume from the default to the values.
 MyPawn.SprintFootStepVolume = 0.0;
 MyPawn.WalkFootStepVolume = 0.0;
 MyPawn.CrouchFootStepVolume = 0.0;
}
defaultproperties
{
}
 
Upvote 0
Hmm, didn't occur to me that it has potential cheating qualities... But no its not, its to see if players react to the sound of approaching footsteps more than currently thought. This research is into subtle sounds and how players react to those sounds, so making them more obvious or silent is a big part of this.

Thanks Ducky for the pointer! Now have a good idea on how to implement this, though would this require another mutator or would I just call it with the other one in the SprintMutator extends mutator class? So:

Code:
    if (ROGameInfo(self.WorldInfo.Game) != None)
    {
        // This tells UE to use the ROSprintController class, going through the mutator to implement it like a mod
        ROGameInfo(self.WorldInfo.Game).PlayerControllerClass = class'sprintMutator.ROSprintController';
[COLOR=yellow]ROGameInfo(Self.WorldInfo.Game).ROPawnClass = class'sprintMutator.ROFootStepController';[/COLOR]
    }

That won't compile. ROGameInfo doesn't have a ROPawnClass. You will need GameInfo.DefaultPawnClass. The above will then look like:
Code:
if (ROGameInfo(self.WorldInfo.Game) != None)
{
    // This tells UE to use the ROSprintController class, going through the mutator to implement it like a mod
    ROGameInfo(self.WorldInfo.Game).PlayerControllerClass = class'sprintMutator.ROSprintController';
[COLOR=yellow]    self.WorldInfo.Game.DefaultPawnClass = class'sprintMutator.ROFootStepController';[/COLOR]
}

To answer your second question, no you do not need to create a 2nd mutator. It can all be done in one.

Just occured to me, would I be looking and putting these values in a tick event within the new class? Here's what I've got currently for the new class, though I'm not sure if it works yet.

That won't work. The PlayerTick event is only called at client side. You can tune down the volumes there, but the new volume isn't replicated from your client to server and server to other clients. As a result you will not hear your footsteps, though all other players can hear you as clear as ever. The volume change must be initiated from server side.
 
Last edited:
Upvote 0
is there a way to make it so each client can't hear each others footsteps? Thats what the aim is. Hearing their own isn't such a big issue, but if I can get both pretty easily then thats just a plus.

Simply sub-class ROPawn (as I decribed above) and do this in the default properties section of your ROPawn sub-class:
Code:
defaultproperties
{
    SprintFootStepVolume=0.0
}
That will set the SprintFootStepVolume to 0.0 for each player on the server. That's really all it takes :D
 
Upvote 0
I'll still need the super.PostBeginPlay() function in the ROPawn sub-class right? Seem to remember not to forget that.

Update:

I had to make it a simulated function as the compiler threw up a warning about it. Changed it to simulated and it compiled fine.

Something a tad bit off topic but didn't want to create an entirely new post for, I'm trying to set the MAX_STAMINA const to be higher than 100.0. I'm currently trying to set it by doing MyPawn.MAX_STAMINA = 150.0; in the ROPlayerController sub-class I created and not the newly created ROPawn sub-class, I tried it in the ROPawn default properties but got a warning about it being an unknown property. (just using MAX_STAMINA = 150.0 in the default properties)
 
Last edited:
Upvote 0
I'll still need the super.PostBeginPlay() function in the ROPawn sub-class right? Seem to remember not to forget that.
Depends on what you want to do. If you do nothing in the PostBeginPlay function, then your ROPawn subclass will be nothing else than:
Code:
class MyPawn extends ROPawn;
 
defaultproperties
{
    SprintFootStepVolume=0.0
}
If you do need the PostBeginPlay, then yes you must call the PostBeginPlay function of the ROPawn class or else you will simply break the pawn. In that case:
Code:
class MyPawn extends ROPawn;
 
simulated event PostBeginPlay()
{
    super.PostBeginPlay();
 
    // Do my things here
}
 
defaultproperties
{
    SprintFootStepVolume=0.0
}
I had to make it a simulated function as the compiler threw up a warning about it. Changed it to simulated and it compiled fine.
That is because the function definition must be the same as how it is defined in the super class (in your case ROPawn).
Something a tad bit off topic but didn't want to create an entirely new post for, I'm trying to set the MAX_STAMINA const to be higher than 100.0. I'm currently trying to set it by doing MyPawn.MAX_STAMINA = 150.0; in the ROPlayerController sub-class I created and not the newly created ROPawn sub-class, I tried it in the ROPawn default properties but got a warning about it being an unknown property. (just using MAX_STAMINA = 150.0 in the default properties)
const means constant. Constants can only be assigned once and that is at definition level. They can't be altered.
 
Upvote 0
fair enough then, looks like it works fine without messing with the Max Stamina though gonna test it on multiple machines just to be sure.

Update:

So I tested it on multiple machines and footsteps still can be heard from other players, any ideas on why? All I've got in the ROPawn sub-class is

Code:
class ROFootStepController extends ROPawn;
 
simulated event PostBeginPlay()
{
    super.PostBeginPlay();
}
 
defaultproperties
{
    SprintFootStepVolume = 0.0
    WalkFootStepVolume = 0.0
    CrouchFootStepVolume = 0.0 
 
}
 
Last edited:
Upvote 0
fair enough then, looks like it works fine without messing with the Max Stamina though gonna test it on multiple machines just to be sure.

Update:

So I tested it on multiple machines and footsteps still can be heard from other players, any ideas on why? All I've got in the ROPawn sub-class is

Code:
class ROFootStepController extends ROPawn;
 
simulated event PostBeginPlay()
{
    super.PostBeginPlay();
}
 
defaultproperties
{
    SprintFootStepVolume = 0.0
    WalkFootStepVolume = 0.0
    CrouchFootStepVolume = 0.0 
 
}

Maybe your pawn sub-class isn't used. Check this by adding a log statement in the PostBeginPlay function. It should appear on both client and server log.

Code:
simulated event PostBeginPlay()
{
    super.PostBeginPlay();
 
    `Log("My pawn is used!!!", true, 'MyMut');
}
 
Upvote 0
So what we've been doing:

Code:
class ROFootStepController extends ROPawn;
//This only takes place on server side, muting each players footsteps to each other though they can still hear their own.
simulated function PostBeginPlay()
{
 super.PostBeginPlay();
 'Log("My pawn used", true, 'SprintMutator');
}
defaultproperties
{
 //sets the footstep volume from the default to the values shown on server side
 SprintFootStepVolume = 0.0
 WalkFootStepVolume = 0.0
 CrouchFootStepVolume = 0.0
 
}

The error is to do with line 8 which states: Error, Illegal Character in name

Thats all it gives, I've tried changing the "SprintMutator" part with captilised and non captilised "Sprint/sprint" Line 8 is the 'Log line despite not being that on the copied code above.
 
Last edited:
Upvote 0
So what we've been doing:

Code:
class ROFootStepController extends ROPawn;
//This only takes place on server side, muting each players footsteps to each other though they can still hear their own.
simulated function PostBeginPlay()
{
 super.PostBeginPlay();
 'Log("My pawn used", true, 'SprintMutator');
}
defaultproperties
{
 //sets the footstep volume from the default to the values shown on server side
 SprintFootStepVolume = 0.0
 WalkFootStepVolume = 0.0
 CrouchFootStepVolume = 0.0
 
}

The error is to do with line 8 which states: Error, Illegal Character in name

Thats all it gives, I've tried changing the "SprintMutator" part with captilised and non captilised "Sprint/sprint" Line 8 is the 'Log line despite not being that on the copied code above.

You are using the wrong quote sign, Log is a macro and macro's need to be preceded by a ` . The one that you use is a ' .
 
Upvote 0
Woops... Well I've made the changes and now, unsurprisingly, it compiles! But it doesn't log that it has loaded, so it doesn't look like the server is loading the ROFootStep sub-class.

Been messing around as I thought it wouldn't of been loading the ROFootStepController part because of the self.WorldInfo.Game.DefaultPawnClass = class'sprintMutator.ROFootStepController'; line in the mutator sub-class. Don't think thats the problem though as it doesn't seem to be wrong.
 
Last edited:
Upvote 0
Woops... Well I've made the changes and now, unsurprisingly, it compiles! But it doesn't log that it has loaded, so it doesn't look like the server is loading the ROFootStep sub-class.

Been messing around as I thought it wouldn't of been loading the ROFootStepController part because of the self.WorldInfo.Game.DefaultPawnClass = class'sprintMutator.ROFootStepController'; line in the mutator sub-class. Don't think thats the problem though as it doesn't seem to be wrong.

Darn... I forgot that the pawn can't be exchanged like that. My mistake. It will be hard to replace it, because axis and allies have different pawns. An other option is to execute a modify sound console command for each client.
 
Upvote 0