With the help of users on this forum, I've reached a pretty good point in the development. I can have many NPCs walking around and navigating the level pretty well.
The problem comes when I want the NPCs to change what they are doing. Their standard action is to randomly walk around the level, however, I also have a system in place that has them shoot objects out in front of them, which get larger until they hit a wall, at which point they are destroyed. This is to replicate their field of vision, so certain parts are obstructed by walls, but NPCs will still be able to see the player from the 'corner of their eye' so to speak.
When these field of vision objects hit the player, it spawns a remember point at the players location, which the NPC should walk toward, and hopefully be updated when the field of vision again hits the player. This will allow the played to hide from and escape the NPCs.
In any case, I hope I explained that well. The problem is that I struggled to have the field of vision objects relate to the correct NPC, but I think I have that sussed. The issue comes when I want the NPC to follow the player. For some reason, once they have found the player, they just walk straight into a wall and get stuck. I cannot see what I have done wrong.
I'd also like to know if there is a way to simplify what I have done.
Link