Object Reference

I’m adding footstep sounds to all characters in my game but I can’t seem to find out how to reference non-player characters. There’s “get player character” which is what I have referencing the player but the “enemy” needs a reference as well, what should I use or do?

Since its within the Animation Blueprint, you can use the “Try Get Pawn Owner” node to get the pawn associated with it. The same node can be used for the player as well instead of getting the Get Player Character node.

Thank you, that solved it. It came up with another problem though that I will post tomorrow.

Ok, so the enemy pawn and my character are both off of the same animation blueprint, when the enemy pawns move, their footsteps sound like it’s spawning on the player and not at their location. Any ideas? I can post the blueprint if you need it.

It could be something similar in this scenario as well. But, yes a screenshot of the blueprint graph where you play the footstep sound would be helpful.

Here are the footstep blueprints for the AnimBP and Player Event Graph…


Note: The image above is only for the players character’s event graph and not the enemy AI which doesn’t have any footstep blueprints in it.

Alright, so do you want the enemies to have footstep sounds as well? Or is it only for the player? If it’s the latter it’s just a matter of replacing the “Get Player Character” node with the “Try Get Pawn Owner” node. If you want both of them to have footstep sounds and you haven’t used Blueprint Interfaces before, then now would be a good place to start.

Thank you so much Stormrage, I was able to figure out how to reference each pawn correctly and now they all have their own footstep sounds with attenuation. What was causing the issue mainly was “Get Player Character” node in AnimBP which was making all footstep sounds spawn on the player, once I replaced that with the “Try Get Pawn Owner” node it was a straight forward process.