set_command() does not work, agen

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

set_command() does not work, agen

Post 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?
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: set_command() does not work, agen

Post 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

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: set_command() does not work, agen

Post 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.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

HoGo80
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Oct 27, 2018 7:09 pm
Contact:

Re: set_command() does not work, agen

Post by HoGo80 »

Is there a way to know, if the path finding took too long or just failed?

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: set_command() does not work, agen

Post 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

HoGo80
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Oct 27, 2018 7:09 pm
Contact:

Re: set_command() does not work, agen

Post 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...)

Post Reply

Return to “Modding help”