I’m confused and need directions please.
I wanna play a sound with the “Play Sound at Location” node but the node only allows you to pick a song out of all the sounds you have.
But I wanna play sounds dynamically depending on what happened in game. And since the game is only based on dialogue and voicelines I really don’t wanna make million branches or switch cases.
Isn’t there a way to load a sound in blueprints with like a “LoadSoundByName” node or sth.?
So we’re using the BehaviorTree for a dialogue which can go in multiple directions and we thought that we’d give each answer an string variable called ID and when showing the answer in the GUI we wanna play a sound that has the same name as the ID variable.
I think a possible solution would be to swap the string variable with a soundcue variable and assign the correct soundcue to every answer-node.
What do you think? No way I can get my LoadSoundByName?
Here’s somebody make structs from CSV ( data table ) files. So you can sort of do that
I know there are plugins that let you load assets by name, I’m pretty sure you can do it with blueprint utility widgets, but I’m not sure about runtime.
Or, you could make a map ( dictionary ) data structure, which is a name lookup for the sound.
Instead of a string you will probably want to use a soft object pointer / reference in blueprint. Those are references to an object (the sound) which can be used without loading the class into memory, just like a string. But with the benefit that you don’t have to mess around with paths and names in strings which are more fragile.
Normally in these cases I make a struct for a datatable, in which I specify the sound for a dialog and any other properties relevant to the event. Then I store a reference to that table row wherever I need, in your case per voice event. Datatables can also be imported and exported CSV.
If you do the above you can just load a row from the datatable, get its sound and play the sound through a single node.
So I’m starting with this method first and it looks very promising now but I have one question. My soundpaths are always /Game/bla/blabla/filename.filename
Always the filename followed by a dot followed by the exact same file name again. Same with Sound Cues or Sound Wave files.
It doesn’t bother me that much but it feels “dirty” combining the same string twice to the path…
The first approach did the trick.
Thanks @ClockworkOcean for the fast reply and thanks @Roy_Wierer.Seda145 for providing me with different approaches <3