hedgie17
(hedgie17)
August 13, 2020, 5:15pm
1
This is a very noobish question but oddly it’s one where I can’t seem to figure out.
I have a struct array where I need to fetch say, monster at ID 5, not index but the ID must be 5. As far as I can tell, there’s no blueprint way to go about this or am I just skipping a step?
[Struct_array]
[Index: 1| ID: 5 | Name: Monster Guy | HP: 10]
Pseudocode:
Find in Struct_array WHERE ID == 1
Everynone
(Everynone)
August 13, 2020, 6:00pm
2
For Each Loop with Break through the array of structs, compare IDs, once you’ve found the ID, break the loop.
hedgie17
(hedgie17)
August 13, 2020, 6:01pm
3
Okay nevermind, turns out the solution wasn’t in the direction I was expecting.
I created a reference array where the variable type was [INTEGER | STRUCT]
The tooltip says it acts as a dictionary. So I added the default values as a test and went to the blueprint.
In the blueprint i simply did FIND using the ID variable I was trying to use and connected it to a break struct.
Works like a charm
hedgie17
(hedgie17)
August 13, 2020, 6:31pm
4
Good point, should have added it in the answer. Thanks!
Everynone
(Everynone)
August 13, 2020, 6:21pm
5
a.k.a. a Map, if anyone else is wondering:
Creating and editing Map containers, an advanced container type, in Blueprints, including an overview of this container's properties.
1 Like