How to play a sound effect whenever the value of a variable changes

Hi all. I use texts in my scene to show my location in X and Y using integers. These values change whenever i move around. I want to play a sound effect every time these values change. For instance when my X value goes from 13 - 14 - 15 etc. i want to play a sound effect.

I use a timer to check my location every 0,1 seconds. unfortunately when i hook a sound effect to the end of my blueprint it just keeps looping the same sound effect indefinitely.

Here is the setup i use to display the texts

Any help is appreciated.

Do you want if to play every 100 units?

Thank you for the quick reply.

Unfortunately i didnt get your setup to work as it just continued to play the sound when the location was greater than a 100. The reason i divided by 100 was because i wanted to show the values as for example 14 instead of 1400.

Your setup did however made me think about different approach. After some trial and error i was able to put this together:

The get actor location gave me timing issues with the sound so i eventually changed it to a variable instead. Now it works exactly as i want it to.

Thnx for the help!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.