Changing a variable from structure doesnt seem to work

i wanna change the walking sfx when the player is running. but even tho I see that the sound cue has changed it still keeps playing the same sfx. why?

The above looks fine. So how are you playing it?


Also, you do not need to Set the Foot Step var - the whole point of the Set Members node is that you do not need to do that. Note the diamond icon on the node, it sets by reference.

While it should not hurt here, it’s not necessary and could potentially override data when you do not mean to do so.

1 Like

i determine the surface type with a line trace and play it with play sound at location node.

So what happens when you Print the Foot Step → Wood here, off that struct. Perhaps the struct is stale, outdated? Is it possible?

it prints the right name, there’s some naming convention issue here i should have renamed the running sfx to something else but the wood_cue is walking and enemyfootstep is running
and the print string says its changing the variable but nothign happens in game, i still hear the Wood_cue. Running SFX never gets played

So in the above image, before the Play Sound, the struct contains the correct cue - you’ve tested it with the Print String. If that’s true, then the index is incorrect and plays something else.

I can’t come up with another explanation.

1 Like

i renamed the sound effects to make it more clear

are u saying that structure is something static and cant be changed at runtime?

Before you Play the sound, see what’s in the struct, compare it to what the Select node spits out, double check the index.

My assumption is that the Play is playing what you give it to Play. Other than that, no clue.

No. It’s very dynamic. Where did I say that?! If you mean my stale comment - I don’t even know if the 2 screens you’re showing are from the same BP… Perhaps you’re changing the struct in one actor and expect another actor to reflect that change. That will, obviously, not going to happen.

Little info to go on by apart from what’s shown.

If you tested it as suggested above and this prints the right cue but plays another… There’s a nasty bug no one has spotted in a long time. Very unlikely. I just tested it quickly and seems to work fine. But who knows what else lurks in the script.

1 Like

i tested in before playing sound and it seems like it never changes the variable. cuz it keeps printing walkingwood_cue. why is that?

i need to mention that i’m not doing these from the same blueprint, does that make a difference?

So how are you moving that struct data from one actor to another actor? It’s copied data, you must’ve done it somehow, surely.

For the above screenshot, could you confirm that:

  • struct break Wood contains correct cue
  • select returns the correct cue

One of the above is lying to you.

1 Like

i found the problem…

i was changing the variable of the wrong instance. instead i had to change the one that’s being played.

1 Like