Help understanding "set members" node. for nested structs.

Hey

I’ve been hunting around at work etc trying to understand how this functions.

I understand it if there’s only one layer. You just crack that bad boy open.
But Ive got several layers, so I’m wondering how you reach the core.

I thought I could cheekily just use the “add” node at the end and overwrite the data, but it didn’t work assumably as it’s pulling a copy rather than a reference?

I think the problem is im struggling to find a reference for the set members.

I swapped it out for something like this, but I think “find” just pulls a copy, not a reference.
So again I’m just saving nothing in nothing.

So how do you access a few layers of nesting for adjustments?

Update: a few images of the struct layers open and closed.

Also what does this mean when it changes colour?

Thanks for reading.

Nested Structs are brutal.

The difference between ref and copies is tough, It seems you can get lost in copies of copies really quickly.

This is the closest Ive gotten but I do feel like im stuck in a corner of nonsense.

This is currently the only way Itd know how to pass the references down.

But after a week of trying to get this to work, It does feel fruitless.

Although I gotta say making this abomination did make me laugh.

Lol sometimes you just gotta laugh.

Yes. The Key is always working with the references and not with copies to make it work.

A tricky one is when you get elements of for each loops.

The iterated element of a for each loop node is a copy and not the actual reference of the element so if you want to change values of the iterated stucts you must GET A REF of the element by accessing the array in parallel by ref using the loop index number.

this logic also applies on non struct arrays.

If you have an array of bools and then do a for each loop, the element of each iteration inside the array will be the results of the bool variable and not the actual variable. so if you try to set by ref the iterated results in the loop you wont set anything.

2 Likes

Is there a reason you work with indexes rather than use map’s keys? Perhaps there is no other way.


959b274adbe8874bd7fdf21124bb96c2

Indeed.

2 Likes

I did add this to the end to find the exact one? This sounds like what your advising.

Initally when I started I was using this system. But it uses find nodes, which as far as I’m aware just gets a copy, which is fine at filling the infomation in on runtime. But I cant make adjustments and save them as its just copies.

So I swapped over to using “get” nodes for the reference. But the get nodes use ints, and if they were going to use ints, I thought I might as well use ints for the rest as well.

If im honest Im not even sure Ive gone down the right route for any of this.

Updating a map with a struct could look like so:

You update the copy and push it back where it belongs. It ain’t pretty. But, obv, adding nested arrays complicates things by an order of magnitude. And from some other thread:

Updating a map inside a map. I generally script small helper functions that help dig around in the nests. Not sure if that’s feasible or helpful.

2 Likes

I’ve lapped the link and this information for the last 3 hours or so and have come up ends.

I just never seem to have the same nodes at the right times. I rebuilt a lot of it, cutting down on needless bit and optimizing the struct, but now I’ve ended up with a struct like this.

I’m trying to work out a way to re force the information back in again. Assumably I have to work all the way back up again using the structs to the first struct.

Kind of tearing it down, finding the slice I need and rebuilding it back using only refs.

Maybe something like this?

It goes down the line pulling information, and then sets it by referencing all the way back to where I started?

Using that link and the information given, I’m going to rebuild again from scratch and just slowly work my way backwards making sure each layer works, I think I’m mentally starting at the wrong end.

OK So back at it again all morning, and It’s probably the most organised It’s ever been.

This is currently where I’m at.

But every attempt at accessing deeper nests fails.

These are the first attempts. Both failed. I’m guessing because I’m not accessing it correctly. I’m going to do a blueprint debug and see where the info is going.

Attempt 1: I thought I might be able to just slide it back in at its core and be done, but when I push 3 to find the information, It’s back to default.
Attempt 2: I then thought Maybe If I slide it back in at every layer, but again When searching for it, It defaults

Update: Ok looking at the blueprint debug, everything is made correctly. Its just not putting it back in again.
So I guess the question why on a single layer can you access it. but as soon as your a layer deep you cant.

Maybe It has to be Localed like the other one. Saved over and then reinserted.
Hmm

Well. I’ve scoured through the project looking for copies, debugger etc but there doesn’t seem to be any.

This works.

It literally just adds them back in at each layer. I can almost guarantee that something is up, as this was suspiciously working absolutely fine. Which is rare for anything I do.

I’ve hunted through the project looking for copies or something, but I’ve come up with nothing so far.

Thanks to everynone and eldany.uy for guiding me and providing flawless links to get this working.

My final piece is saving and loading This contraption.

Im saving the Final struct but that wont repopulate the rest of the layers. So I guess I need a system to save and load all the layers and then repopulate them all.

Ok hitting the month barrier.

After continuing on for some time, I started getting some funky stuff happening while adding counters and achievements to keep track of the booleans.

For future me,

You need to set the structs You want to adjust before making adjustments, For example, this I put in before I created the widget. So it loads with the correct layers for adjustments.


(If you change hp to 10 on one character and swap to another character and update endurance.
Because the hp was never adjusted back to its default. The new character will get both endurance and hp as the hp is still just lying in wait.)

You set the structs to the ones you want to adjust before you adjust them. Its so strange but If you dont, Itll just stack badly.

The previous post is still the solution, But to anyone getting weird kinks later down the line, check blueprint debugger. I reckon it’s this.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.