Download

Randomly choosing to move to NPC

Hi,

I am trying to get one npc (call it ‘1’)to randomly choose from a range of existing npc’s of a different class (call them ‘2’) and then move to them. The problem I’m having is that the 1’s simply move to the 2 that ive set the moving variable to equal, and they don’t randomly move to all the other 2’s that exist or are spawning in. How could I go about solving this?
Any help is much appreciated.

Add all the '2’s to an array, and do a Get for that array, and make it a random integer between index 0 and Last Index for the array. Use this to select a random target to move to between all of your 2’s.

Thanks a lot!