Hello,
I’ve been struggling with this for a couple of days now. I think I have the logic set up for it (below), but I’m not sure how to implement a couple of steps with blueprint.
I am trying to implement a cover system. The AI searches for the nearest CoverNode blueprint (within a radius, preferably) and returns the location of that cover node to Blackboard. Simple right…?
/*Logic for how to get the nearest CoverNode and return it’s location to Blackboard (no radius implemented yet.)
Get an array of all actors of CoverNode class
For each, get location,
Get the location of the AIPawn
Compare the location of the AIPawn with each CoverNode location
Find the smallest value (i.e the nearest)
Store the index of that CoverNode as a variable (BestNode)
Cast to the Node array with the index of BestNode and get location of that node
Set blackboard key
*/
I’ve not used arrays much before, so I’m very unsure how to get the index of a specific variable in an array, or how to search through them.
This is what I have so far,
I am not sure if this is the correct way of going about what I want to achieve. This is a Task blueprint, in case anyone is wondering.
Any help is much appreciated.