Best way to implement ai resource gathering?

Hey all, I’m wondering how I would go about having an ai gather resources.

For right now I’m not using behavioral trees as I can simply click and tell the ai where to go. But I’m trying to figure out what the best way to have an ai gather resources would be.

My line of thinking is this:

Right click resource, menu pops up, tell ai to gather, they move to location, play animation, destroy actor, resource is added to their inventory, they bring the resource back to base.

and then you know eventually have a way for me to assign jobs to ai some some chop wood, some gather metals etc…

I guess if anyone has a good tut or can point me in the right way to set this up that would be great, or maybe a better way to handle this.

Doing this all in bps by the way.


This might not be too easy as you want to also have different items to be collected.

however: proof of concept:

1-) You want your AI to do a scan somehow of the surrounding area. you might wanna setup some kind of limit to how far the ai can go to harvest. if you can get the Location of Resource, you can make ai move to that point

2-) a raytrace function will need to be called to confirm which actor the ai is infront of

3-) using blueprint interface you can change the amount of items left in the resource without knowing which actor to be referencing.

4-) each time raytrace is done the amount of items left is checked. if it is = 0. destroy actor

5-) Inventory setup. now this is a whole another matter you gotta get a working inventory for these guys. a array containing the items can suffice.

6-) Play the animation While harvesting function is being called.

Thanks that’s all I really needed I’m just not sure how I wanna go about it yet.