Page 1 of 1
[SOLVED]How to detect if a player is moving?
Posted: Mon Apr 30, 2018 7:26 am
by Villfuk02
I'd like to detect if a player is running. Is there any way to do so?
Re: How to detect if a player is moving?
Posted: Mon Apr 30, 2018 9:32 am
by steinio
Villfuk02 wrote:I'd like to detect if a player is running. Is there any way to do so?
http://lua-api.factorio.com/latest/even ... d_position
Re: How to detect if a player is moving?
Posted: Mon Apr 30, 2018 10:00 am
by Villfuk02
Tis looks usable. Not exactly what i was looking for, but with few lines of code, i can divide by moving speed (affected by exoskeletons, etc..)and ignore other means of transportation. THANKS!
Re: How to detect if a player is moving?
Posted: Mon Apr 30, 2018 10:22 am
by steinio
Villfuk02 wrote:Tis looks usable. Not exactly what i was looking for, but with few lines of code, i can divide by moving speed (affected by exoskeletons, etc..)and ignore other means of transportation. THANKS!
Yes i just wondered because your topic states moving and your text states running.
There is no LuaPlayer.speed or i didn't find it.
Re: How to detect if a player is moving?
Posted: Mon Apr 30, 2018 10:25 am
by Villfuk02
I just meant if he is normally walking/running (default by using WASD)
Re: How to detect if a player is moving?
Posted: Mon Apr 30, 2018 9:30 pm
by Rseding91
Re: How to detect if a player is moving?
Posted: Tue May 01, 2018 1:24 am
by eradicator
Depending on what level of precision you need, either .walking_state (linked by Rsed) or defines.events.on_player_changed_position.
Re: How to detect if a player is moving?
Posted: Tue May 01, 2018 5:11 am
by Villfuk02
Thanks! that's exactly what i searched for