I am trying to figure a way to implement “resource gathering”. For example, in order for me to build a hut or structure, I need wood. I need to gather that resource from the trees.
How would I script that so that when I hit the tree, it gives me wood. Then eventually the tree runs out of wood and falls over and then runs a destroy object on itself. The same thing with rocks, for mining.
I tried entering this question into the forums different ways and was not able to find an answer.
Thanks for your help.
You need an inventory or backpack.
The legendary Tom Looman has a great post about this!
There’s a C++ version and a Blueprints version.
For implementing resource gathering, the simplest approach will be to have a distance check and a raytrace to check if the player has “hit” a resource structure.
If they hit a resource structure, then add a number of resources to their inventory as guided by Looman’s tutorial.
Pally QLE does a great job explaining how to implement resource gathering. What’s even better - he provides you with the entire project that you can pick apart that shows you how to do it. Check it out.