Parse actor data into string then extrapolate data

Hi,

How can I parse through important data into a string, find the parts that I need and then push them to a Spawn actor node.

I’m currently appending all the data like so and splitting the parts with a dash “-”

I then want something to split the data up like the actor location, quantity and the data asset that it is. Split gives me a good start but I would need just the X value and not the rest at the end. As the vectors wont always be the same amount of char length I can’t just chop by x number.

My end goal is to pass the data into this

i cant really understand why though?

can you not use ExposeOnSpawn, a struct? a UObject Payload? An FInstancedStruct? or possibly serialize and deserialize the data?

otherwise you could

and then loop over the array but im not sure if thats helpful

Basically I have a save state actor that handles all of the saving logic. I create a child of the actor, in this case a pickup that spawns when opening crates. For the save logic I then parse a key and a value as a string.

For this I need to give it a key of SpawnedFromLoot or something similar and the value will be all the info I need to spawn the object again when you load the save. If the player doesn’t pick up the items then I want to spawn them with the item type, location and quantity.

Not sure if the Parse Into Array will help. I could break the Vector to its X Y and Z but then I still need to find there exact values and output them in the way I want.

I guess what I’m trying to achieve is the opposite of an Append. I add whatever is needed to the append, save it then reverse the append to output the saved data

you should look into serialization then, this is basically what it does but is already implemented, unfortunately it does require some c++

can you even convert from string to say vector? ive not tried? still based on what youve said a map would be better you can have the key/value as type string then iterate over the keys.

i still dont really get why you’re trying this way over the other methods i suggested above?

There is a build string vector node but not sure what makes it different than just appending each coordinate like I’m already doing.
I’m mapping the string to a level data structure so that each save slot will check the save, what the current level is and then load anything associated with that level. It’s already quite elaborate and it works well.
I could use a struct sure but then I’d have to create a specific struct per save object. The beauty of using a string is that I can define how it behaves without hard coding any value. When the object is created I then check the parsed string value. This one is a lot different to the rest because there’s more to keep track of. I’ll keep experimenting with the string for now, even though it requires a bit of complex setup, it will be simpler in the long run for what I need it for

i get that, so yeah best option is use serialization

but with your current method use a Map with strings. then the key is the type ActorLocation and the value is the Vector (as string)

1 Like