Can you randomise 'Move To Location'?
Sorry if this is a stupid question but I am wondering if you can have multiple goals that randomise the Simple Move To Location goal?
I am currently using the get random reachable point in radius but its not what i really want. Could I somehow set a couple specific position and my AI would randomly choose between the goals which one to go to?
This is how I currently have it setup!
asked Apr 06 '17 at 11:18 AM in Blueprint Scripting
This is definitely possible. Here's how you can do this:
What I'd do first is make however many vectors you want. I used 3. Then, create a Vector Array variable and use the 3 vectors you created to set it as shown below:
Then, you'll need to pull off of a reference to your Location Array variable, and then add a Get node. For the index, we'll want to get a random number, which will pull a random stored vector from the array. To do this, I used a random integer in range node. Keep in mind that arrays begin at element 0, so the range would be 0-2, not 1-3.
All you should need to do now is plug the return value of your Get node into your Goal pin on your Simple Move to Location node, as shown here:
This should give you the results you're looking for, but definitely let me know if it doesn't work and I'll take another look at it.
Have a great day!
Follow this question
Once you sign in you will be able to subscribe for any updates here