npruehs/ue4-rts

Issues/bugs, may I get some help, please?

Closed this issue · 4 comments

Hi!
I've got some issues...I'm really trying to understand the code, but I still have issues with it...may I get some help, please?
Whenever I ask a worker to build a construction, the worker gets stuck inside the construction and I cannot assign more workers to the same construction.
If I ask a worker to gather resources, it works perfectly, but if I move the worker somewhere while he's getting back to the base, it's getting bugged, it becomes unable to get or drop resources anymore.
Is there any command for resetting the number of carried resources? I can't find how to get the number of carried resources....

I'm sorry if the problems may sound a bit silly...but I'm still learning... ^.^

Hey @ForgottenFrog,

that's multiple questions, so let's take a look at these one by one:

  1. What construction mode are you using, i.e. at the RTSConstructionSiteComponent attached to your building, what's the value of the Construction Cost Type? Also, what's the value of MaxAssignedBuilders?
  2. The worker should be able to drop resources at any building with a RTSResourceDrainComponent configured to accept the respective resources in its Resource Types. In any case, the number of carried resources is stored in the CarriedResourceAmount property of the URTSGathererComponent.

Hi! Thank you for your reply!

I've managed to solve the workers problem. Sorry about that one, but the second problem is still there...

So...whenever I select a worker, I command it to mine, it gets the resources, goes to the base, drops them and then returns to the resource source.
That's great, it works, but only if you don't bother the worker

Once the worker is carrying the max amount of resources and I cancel his command to drop them to the base (let's say I want to build something...), the worker is unable to collect or drop any resources anymore.

Once the return command gets cancelled, the resources can't be dropped, resetted or checked anymore.

And, regarding the resources, I spotted a problem (Idk if it's only my case...) The maximum amount of resources of a resource source can be changed, but the current amount cannot. And Idk why, but no matter how I change that number, if I use a simple print string to get the current resource amount, it is always starting with 1000.

Well observed! Thanks for sharing!

The first issue is actually rather a misconfiguration: The order for returning resources was not added to the list of orders that can be issued via right-click. I've pushed a fix in f6f885f, but you can quick fix that in your project by adding the order to the DefaultOrders array of your player controller blueprint. Note that the order of orders is important here - the ReturnResources order should be added right before the MoveOrder.

The second issue is a bug in the initialization of the current resources. I've added a fix in f2099a6.

Thank you for solving the problems! I really apreciate it.