I’m getting a blueprint runtime error, “Accessed none trying to read property CallFunc_Array_Get_Item,” but I haven’t been able to find a solution online (yet).
For context, I’ve made some NPCs that will eventually be performing an assortment of behaviors in game. At the moment, they only patrol paths described by arrays of vectors, chase the player, and search for the player around the point they lost sight of them. I’m planning to give them more behaviors than that, though, and I don’t want to manually match each patrol route, station, guard post, etc. up with an NPC, so I put in a job assignment behavior to automate it. Ideally, I could just place the appropriate amount of NPCs into a level and have them assign themselves to jobs without oversight by checking for jobs that don’t have a certain variable true (for now, it’s called, “patroloccupied”). The behavior that I’ve made to do this, though, isn’t working. Also, each instance of, “Task,” in these screenshots refers to actors tagged, “Task,” with arrays of vectors for NPCs to walk around to. I forgot that AI behaviors were also called tasks before I started designing. Should probably fix that.
After seven seconds of play, the behavior grabs references to all appropriately tagged actors (the patrol routes) and populates an array with them (and then a secure array, because I can’t give it variables ahead of time to read from object references in a normal array). Next, it attempts to read the bool, “patroloccupied,” on each object in the secure array until it finds one that reads false. It stores a reference to the actor of the first available job on the NPCs blackboard, marks the object as occupied, and moves on.
Problem is, it can’t read the variables from the other actors once it’s trying to call those actors from an array. Even if the actors in the array are stored as variables on a blackboard and then called, it still can’t use Get (a copy) to read the public bools from those actors. Same story when I try to cast to the object using the blackboard variable. It just fails the cast each time. I’ve found some references to this error online, but without much useful advice, or in entirely different situations.
If there’s an obvious mistake I’m making (other than calling things more than necessary, but I’ll fix that later), or a better way to store lists of actors that preserves the ability to get variables from them, I’d love to hear it. In case it helps, here’s the diggity dang blueprint.
Thanks for your time!