True and False firing simultaneously

Hi Everyone,

I’m trying to implement different footsteps in a game depending on the area. (For a variety of reasons, using physical materials actually complicates the situation, rather than resolving it.) In my Blueprint code, I check to see if my player is overlapping a series of trigger boxes (referenced in the player character blueprint as a set of actors and then turned into an array to be looped through to check if the player is overlapping any one of them). When the player is NOT overlapping, the “Stone Footsteps” sound event is called, as expected. However, when the player is overlapping one of the boxes, BOTH footstep sound events, on true and false, get called simultaneously.

Since my stone steps are pretty quiet, the effect isn’t terrible, you can barely hear the steps beneath the splash step sound. However, I’m unable to work out why the branch doesn’t seem to be working correctly. Is it a problem with my For Each Loop?

I’ve tried EventActorBeginOverlap, but I’m not sure how to loop through the trigger boxes in my Variable Set (“Second Courtyard Flood Triggers”). I’ve also tried setting up the trigger boxes as Blueprint actors and doing a “On Component Begin Overlap” however that is working less effectively and I still have the problem of my default “Stone Steps” sound being called.

Any thoughts on 1) what is going on with my branch firing both true and false? and 2) how I could change the footstep sound for the specific (and temporary) moments that a player enters various areas/boxes in the game world?

Thank you so much in advance!

I don’t really think you understand how for loops work. Your branch fires one time for each actor inside your array. If there are 10 triggers, the branch you are complaining about is fired 10 times. What happens is that your player overlaps with some of your trigger actors, and doesen’t overlap with others.

Another problem with your approach is that you are testing if your actors overlap each frame. That might cause performance problems. You should use “begin overlap” and “end overlap” events to do this, it would be way easyer.

Thanks so much for your feedback, Idragosl! I’ve followed your advice and created blueprints for each of trigger box that should cause a different footstep to play. On BeginOverlap I have set player bools to true saying that the player is in set trigger space. For each trigger I have an event that plays the correct footsteps (see attached). On my player character I have set a default footstep sound that plays if the player is moving. However, I only want the default footsteps to play if the player is in NONE of the trigger spaces where alternate footsteps will play. I have set up my four bools but the StoneSteps default footsteps event is firing anyway. Am I missing something? Can you recommend something else in here to get rid of the underlying default footsteps when the other trigger events are called?

Thanks so much in advance!!