Accessed None trying to read property CallFunc_Array_Get_Item2

Hi guys, I’m having a massive issue with some basic AI.
I know little about AI and even less about how to deal with it in a board game-esque/RTS style so I’m going with something quite simple.
I have a link at the bottom which directs you to my script I am running and it is constantly giving me errors, which seem to tell me there is something wrong with my arrays, but when testing them outside of this blueprint the arrays seem to be functioning as they are supposed to with the correct amount of items and the correct items in the array.

There are a few things I have noticed though, with the “NearbyColonies” array plugged into the ForEachLoop I have dragged out the array element and plugged it directly into a print string and every so often there appears a blank string, which either means a blank part in the array, or an actor with no name. However, outside of this blueprint I have performed the same task and the array has no gaps and appears to have everything correct going on inside it.

I understand an IsValid node might stop the errors but something is clearly going wrong somewhere and I would much rather resolve the issue rather than putting a plaster over it, or at least understand what is going wrong before I put an IsValid node in front of a few of these arrays.

I feel like I have tried everything but I am at a bit of a loss, so if anyone has any ideas that would be great, thanks! :slight_smile:

Link: Accessed None trying to read property posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4

Oh my god I’m so dumb.

So in a sense I was right, there was nothing wrong with my array. However, everytime the “Random Integer In Range” was called it was doing exactly what it said on the tin and giving me a new random int at every point in the loop therefore referencing a new actor at each point in the loop, therefore giving me all kinds of errors.