Is there a way to make a character actually walk or preferably a way to emulate a key press from a player? For example if I wanted to write a bot for factorio, are there any functions for emulating control? Unfortunately you can't do a lot of things realistically with the functions I have found, such as mining an entity. Hopefully there is a way to do this without using some kind of external method
EDIT:
LuaPlayer.walking_state is labelled as read-only on the wiki, but the example shows it being set, could anyone clarify which way it is used? (Can't access a PC right now) And also mining_state.
Controlling a character with lua
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: Controlling a character with lua
Not sure if you can control the player avatar much, but you can certainly control other entities, for example:
https://mods.factorio.com/mods/kyranzor/robotarmy
https://mods.factorio.com/mods/KatzSmile/trucks
https://mods.factorio.com/mods/kyranzor/robotarmy
https://mods.factorio.com/mods/KatzSmile/trucks
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: Controlling a character with lua
In 0.12.35 the documentation listed walking state as read-write. You could make char move around or steer a vehicle by modifying the field.
In 0.13 the field is listed as read, who knows maybe its typo.
Other actions like mining and shooting are not achievable in this way.
In 0.13 the field is listed as read, who knows maybe its typo.
Other actions like mining and shooting are not achievable in this way.
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.
I also update mods, some of them even work.
Recently I did a mod tutorial.