Get Index Integer of Overlapping Actors

Not sure if there is a good way to do this or if this has already been added in later versions. What I am basically trying to do is find the Index Integer(s) of a duplicated object(s) in the world within a radius from the player. For example: If I create an actor blueprint with a cube and call it “Cover” then duplicate it at three different points spread out across my map, I want to get the specific Integer associated with it when I “Get all actors of class” when I am in proximity of it. Here is my set up so far:

The rest is a simple AI move to so the AI takes cover at the Cover blueprint with the random integer. This works. However I get an accessed none error from AI move to when I plug in the “Find” to the “Min” input. If i don’t have that plugged in or if I hook up the Find to the Get all actors of class, it wont give me the error. “Cover found” is just a trigger box. I wish there was a “First Index” input like there is with the “Last Index” but with Find it says it gets the first index integer so that is why I thought it would work. For some reason I get an error with the AI move to even though the AI moves to the point like it should.

Trying to make some progress. Realized I didn’t need the Switch on Int. Thought it would help if I set the index integer before the AI is set to move but that didn’t work. Here is a new modified setup to set the integer before the AI moves and only when it is overlapping with the cover. It works. But gives these same errors as before for some confounded reason:Error Accessed None ‘CallFunc_Array_Get_Item11’ from node AI MoveTo in graph ‘EventGraph’ in blueprint AI ; Error Accessed None from node AI MoveTo in graph ‘EventGraph’ in blueprint AI. I even somehow got the error to say Item12 which I didn’t know if that was progress so I set it back to the way I had it at Item11.

So my problem is solved for now haha. It was taking issue with the “Find” node which does get the first index integer yet caused that error. Fixed it and it just took a little math on my end since there is no “First Index” node at least in the version I am using which is 4.8. Anyway for anyone wanting to do this same thing I have my revised inputs.

EDIT Going further I realize that this setup can cause issues if not careful. You would need to keep track of the duplicates of the blueprint in your level. If you accidentally duplicate or move a duplicate which has an Index Integer far greater or lower to a different set of duplicates. For example, I have 3 crates with indexes of 0,1,2 respectively. I duplicate 2 of them which now become index 3,4 and move them off in the distance. Oh but then I decide I want 3 crates in the distance instead of 2 so I move the crate with index 0 there. Then the sequence that occurs when overlapping those is 4(last) - 3(length) + 1 = 2. That is bad. As well lets say I duplicated 2 more which become index 5,6 and move them somewhere. Then I go back to 3,4 and say I need another so I duplicate one of them. That duplicate becomes index 7 which further messes up the system. If there was a first index node there would still be problems just like in the last example.

MORE EDITS Testing my theory of the info above leaves me with a new issue. I duplicate 3 of the “crates” and even check their indexes which are correct and are 3,4,5 respectively. Then when moving to those crates the AI, instead of moving to random integer within those chosen by the overlap I believe it chooses the length of the entire array of the blueprint and not just the ones it is overlapping for some reason. I tried testing this and it seems I was both right and wrong. To test it I changed the ( + 1) to ( + 4) so then it would give me only numbers from 3-5. That worked but it only chooses 3 no matter how many times I test. Not sure why but it may just be bugging out like the overlapping node may be. I am going to leave this unanswered as I do still need help it seems haha.

So I figured out a work around to my issues above, yet that always comes with more problems. For some reason the engine likes to hate me sometimes and create a problem for me that I have no clue why it is doing it. See for yourself: Note - the custom event is connected to Event tick