Setting members in a struct array not working?


In this image I have an array containing structures with an array in them. I know for each loops return copies of the array so I get the reference of the array from the index however, when I set the integar in the last array to 5 and print the value after it is not 5. Am i doing something wrong?

P.S. I have checked and all of the arrays have atleast 1 element but for some reason when I set the integar in the struct and print it, it never changes?

Please help me fix this. Thank you!

From what I understand you can’t change the value of members of a struct at runtime, only add or remove the member. From what it looks like your struct values are a string and int, this data would be better handled in a MAP.

you definitely can, they’d be pretty useless otherwise :stuck_out_tongue:

you’re halfway there, it looks like your getting a Ref from a Copy. You need the original Array too.


I now do this to get the references and not the copies however, when I set the number to itself + 1 and print the value afterwards it is only ever 1 and does not increase.
If I set the number directly to 5 and then print it, it show 5. So it is setting the number but only doesnt work when add 1 to itself.

even ‘Values’ is a copy i’m pretty sure, but a triple loop? it might be better to ask what you’re trying to do and find a better way.

Thank you!
I am trying to make a quest/objective system. I want it to be similar to Fortnite’s quest/challenge system that can give any type of reward like xp, money, vehicles etc.
Currently I use an actor component on the player state to keep track of it all and another actor component on all of the actors that can contribute to a challenge like destructables and enemies. I need it to allow for quests that have stages and the stages need to have objectives like kill 20 of something or travel to a location etc. I am using strings as IDs to communicate between the actor components to say what objective it will count towards. I then use a data table to create all of the quests and what objective the stages require. Do you think there is a better way of doing this?

its hard to read the details in the small pic but for starters it looks like you can use a find node on the map to find your quest which should eliminate some loops.

find returns a copy but you can SetMembersInStruct and then Add it back to the map