Mute AnimNotify_Sound if mesh is hidden (not the owning actor)?

When toggling from 3rd to 1st person, I set the pawn to be hidden. This is so the player doesn’t see the 3rd person mesh, and also because there are AnimNotify_Sound’s playing on the 3rd person anims, that I want to mute when in 1st person (like reload sounds etc). The anim sounds I want to mute i have set to ‘Ignore if actor is hidden’.

The problem is that when I set the pawn to hidden, the AI can no longer see the player. If I set the 3rd person mesh to be hidden, the anim sounds still play because the owning pawn is not hidden.

Is there any way that I can set the AnimNotify_Sounds to not play is the mesh is hidden and not the owning pawn?

I guess one solution would be to override AnimNotify_Sound with my own class. I tried adding my own, but it doesn’t show up in the editor. Anyone know how I can get it to show in the editor?

Try creating an archetype?

Thanks for the response @Yummy-Vegatables. I managed to get it working by writing my own AnimNotify_Sound class:

class MyAnimNotify_Sound extends AnimNotify_Scripted;

var()	SoundCue	SoundCue;
var()	bool		bIgnoreIfOwnerNoSee;

event Notify(Actor Owner, AnimNodeSequence AnimSeqInstigator)
	//Don't play sound if bIgnoreIfOwnerNoSee == true and the player mesh is currently set to bOwnerNoSee == true 
	//Note: This only applies to the owning player of the skelmesh. Other players will always hear this sound.
	if (bIgnoreIfOwnerNoSee && 
		MyPlayerPawn(Owner) != none &&
		//Basically this is so only the owning player can exit here without hearing the sound. 
		Owner.GetALocalPlayerController() == MyPlayerPawn(Owner).Controller && 
		MyPlayerPawn(Owner).Mesh != none && 
		MyPlayerPawn(Owner).Mesh.bOwnerNoSee) {

	//Play the sound from the owner of the skelmesh doing the anim
	if (Owner != none) {
	}//Play sound from the worldinfo class (for when in the editor). @Todo This doesn't play in the editor.
	else if (class'WorldInfo'.static.GetWorldInfo() != none) {

Doesn’t look that pretty, but does the job nicely. Only issue is that the sounds don’t play while in the animation tool in the editor. If anyone knows why not, i’d love to hear.

Start by adding some logs, to test whether your implementation is called at all in the editor and to see what kind of Owner and WorldInfo (if any) you have available. I’m not even sure PlaySound on the WorldInfo works in a normal game, but it would be something you could try.

It doesn’t seem like it’s even calling the notify event from the editor… I’m guessing i need to register the new notify type somewhere for it to work in the editor…?

It’s working fine in game at the moment though.