Find in array by value?

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

For Each Loop with Break through the array of structs, compare IDs, once you’ve found the ID, break the loop.

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 :wink:

Good point, should have added it in the answer. Thanks!

a.k.a. a Map, if anyone else is wondering:

1 Like