Download

Changing currently playing music loop from AI Behavior Tree?

Hello! I am brand new to trying to use Unreal Engine. I’m a hands-on learner, so I’ve been watching a lot of tutorials on YT and using my Skillshare, but what I want to do is a little bit different than what I’ve seen, and I have reached the end of my current ability to try without asking for help.

I’ve created an AI Behavior Tree. It handles small things like patrolling, chasing the player, and searching for the player when they break line of sight. Pretty standard stuff that everyone with YT tutorials helps to teach. It’s working great.

I’ve created a music manager based on another tutorial, but their end result is changing music when the player walks through an invisible volume. I’m sure it works great, but that’s where I tried to tread my own path.

I am trying to reference and adjust the value of the “IndexOfSongToPlay” variable to switch music tracks upon a perception event for my AI characters. At first I was having some pretty bad failures because I was trying to cast to the AI instead of the music manager, but I got those references sorted out (I think), and it no longer threw any errors on compile. It even added the “Status Song” variable to my “ChangeNPCSpeed” service. I thought I had it in the bag. I thought it was going to work. I was smiling and happy and I just knew it was going to work.

It did not switch songs, but the original track still played.

And then I got a little dumb and started calling everything I could think of in the music manager to try and FORCE IT TO WORK. It was my Hail Mary moment. Yet somehow I was even MORE confident in it working this time.

It still didn’t work, but the original track continued to play, so at least I learned a way to complete a lot of references without breaking what I had already put together.

I’m now at a point where I not only don’t know how to make it accomplish what I want it to, but I’ve exhausted everything I think could work. I’ve continued to watch videos and I’m trying to read more about it, but it’s more difficult for me to learn through text.

If anyone has any help they can offer so I can figure out what I broke, or what I’m overlooking, I would really appreciate the opportunity to learn. And I bet it is something tiny and dumb that I’m messing up. If anyone can go one step further and let me know how to implement a quarter to half second fade between tracks, even better.