Page 1 of 1

set_command() does not work, agen

Posted: Fri Feb 10, 2017 10:49 am
by Adil
I remember something like this was brought up before, and the answer was given somewhere.
But not somewhere in the documentation of the function, and forum search fails me.

So the problem: I spawn a few units and try to give then orders, instead of doing orders they just mill around.
Code
Wat do?

Re: set_command() does not work, agen

Posted: Fri Feb 10, 2017 3:16 pm
by Klonan
They won't instantly start walking when they are given the command, they first have to do the pathfinding, until they have a path they will idle. If the pathfinding takes too long, or there is no path, they will discard the command

Its better to set them all in a unit group, and set the command on the group, which reduces the number of paths the game has to calculate

Re: set_command() does not work, agen

Posted: Fri Feb 10, 2017 11:07 pm
by Adil
Well, the problem is that they didn't walk to a position 20 tiles away. The only way I got them do something, is by adding them into a group, then they did try to run to a group position. They did that without a pathfinder though and got stuck in the obstacle on the most direct path.

Re: set_command() does not work, agen

Posted: Sun Feb 03, 2019 12:42 pm
by HoGo80
Is there a way to know, if the path finding took too long or just failed?

Re: set_command() does not work, agen

Posted: Sun Feb 03, 2019 12:53 pm
by Klonan
HoGo80 wrote: Sun Feb 03, 2019 12:42 pm Is there a way to know, if the path finding took too long or just failed?
In 0.17, you will have some information when a command completes:
https://lua-api.factorio.com/0.17.0-pre ... _completed

Re: set_command() does not work, agen

Posted: Sun Feb 03, 2019 1:05 pm
by HoGo80
Thank you for the idea and fast reply, already looking for a way how to hookup on events (newbie in this language)

(A bit slow after lunch: it will not work, if I dont have that version...)