Project Zomboid

Project Zomboid

Not enough ratings
Better Automatic Movement
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
1.437 MB
19 Jan, 2023 @ 9:02pm
8 Feb, 2023 @ 9:36pm
4 Change Notes ( view )

Subscribe to download
Better Automatic Movement

Description
Better Automatic Movement

My friend wanted to be able to toggle automatic movement (continuous forward movement without pressing keys or the joystick unless changing directions), so I looked into it. This mod is the best I can do for now. I am aware that the game has some degree of what one might call "automatic movement" in the form of the walk to function, but that function is slow-to-use in vanilla, no good on the map, and no good on gamepad. This mod therefore aims to bring better automatic movement to Project Zomboid (albeit marginally better).

Main Features

Currently, this mod allows both keyboard and gamepad users to walk automatically using a toggle shortcut. This toggle shortcut activates truly automatic walking (albeit with some minor wandering behavior from time to time that I cannot entirely eliminate due to the pathfinding mechanism used to accomplish this mod), but "truly" automatic jogging or sprinting (activated and deactivated on toggle) seems to be impossible in Lua. Note that you may freely take over manual control while you are automatically walking, and you will return to automatic walking when you stop manually controlling your character. You may also freely open your map while automatically walking, but closing the map with gamepad's Circle (or B) will cancel automatic walking, so, if you want to keep autowalking after opening the map on gamepad, you will need to close it by using Triangle (or Y) to get to the selectable buttons, navigating to the X button, and pressing Cross (or A).

This mod also allows users to move to locations on the world map. This feature can be activated by a bound key or a gamepad bumper. Keyboard-and-mouse users can activate jog or sprint during this kind of automatic movement, but, unfortunately, due to limitations that are established in the Java code of the game, gamepad players cannot. I desperately tried to work around this and failed for days. If anyone has any solutions to this, the comment section is open!

Mod Options

This mod does not enable any shortcuts on gamepad or keyboard automatically (there are no default bindings). You must use Mod Options to set your shortcuts. Keyboard users can do so via the Key Bindings menu; gamepad users can find Better Automatic Movement in the Mods menu.

This mod offers several options via Mod Options. In the Mods tab of your Options menu, you may select either Gamepad Shortcut (L1) or Gamepad Shortcut (R1) to enable an automatic walking toggle shortcut. L1 is also used to unload your ammunition when you have a gun equipped, and R1 is used to load it. I have therefore added yet another option called Autowalk Off When Wielding Firearms, which disables the ability to walk automatically when you have a reloadable weapon equipped in either hand. This should prevent L1 or R1 from triggering automatic walking during combat situations when you may want access to the vanilla L1 or R1 function (and when it would conflict with vanilla commands, anyway), but it will require you to unequip guns before you can automatically walk. Considering this conflict, I recommend disabling the shortcut while a gun is equipped if you play with a gamepad, but it is not strictly required, and this option is off by default, because it is unnecessary for keyboard players.

Details

This mod relies on the game's built-in Walk-To functionality, which is a pathfinding timed action. Since it is a timed action, you cannot perform other timed actions (such as smoking or eating) while it is active (trust me, I am at least as disappointed as you are), but I have enabled the ability to temporarily interrupt automatic walking to perform other timed actions. This mod hides the timed action indicator because I expect people will enjoy walking around without it, but you may choose to show it using Mod Options.

In order to walk to a location on the map using gamepad, move to that location using your joystick and triggers as usual, and press either L1 or R1. Again, this option can be bound on keyboard in the normal way (in key bindings). When playing with a gamepad, this shortcut will automatically exit the map, because otherwise you would cancel automatic walking as soon as you exited the map. When navigating to a distant location using the map, your character may stop periodically; this seems to be a quirk of the pathfinding system, which clearly wasn't made to travel across huge sections of the map. Sometimes, pathfinding simply fails, and stops itself. I therefore wrote a mechanism that will cause pathfinding to attempt to restart a new path to the original destination if it is forced to stop in this way; this seems to be effective in getting the character to reliably continue along long straight paths, at the very least. I am sure you can get your character to follow weird loops or become stuck if you try; the game's pathfinding system struggles at times, and improving it is beyond the scope of this mod (and Lua modding in general).

More Mods

Like this mod? Feel free to check out my other stuff on the Project Zomboid Workshop:

Wookie Gamepad Support: Add better gamepad support for various features and mechanics.
Jumper: Teleport to countless locations with or without friends instantly.
Meditation: Sit, cross your legs, and meditate in order to hide, rest, and recover.
Dawn of the Zed: Selectively hide UI elements on gamepad or keyboard.
Interface Reflexes: Close windows that clutter your screen by aiming or using a shortcut key.
Mobile Reader: Keep walking or driving while you read books or open your map.
Trash Talker: Given a trait, you will talk trash when you kill zombies. Customizable lines. Talking draws zombies.
Position Breakdown: Show your location (in tile, chunk, or cell terms) in a simple, highly customizable overlay that can be toggled using Dawn of the Zed.
Legible Container Headers: Makes your inventory capacity easier to read under various resolutions and font sizes.
Legible Mods: Makes the windows for various hosting options larger so that longer names of mods and their locations can be read.

[ko-fi.com]

Workshop ID: 2920683818
Mod ID: BetterAutomaticMovement
16 Comments
Burryaga  [author] 5 Feb, 2023 @ 10:11pm 
Haha, hey, I made a mod that lets me become invisible by meditating, so I'm definitely a fun over realism kind of player.
unclefmg 5 Feb, 2023 @ 8:46pm 
I am going to give it a try, so thank you. Yes, it will be with my wholly, absolutely, shamelessly OP Black Ops Insurgent, but it's all about how each of us enjoys the game, yes?

(If it is not against protocol: https://steamhost.cn/steamcommunity_com/workshop/browse/?appid=108600&searchtext=insurgent&childpublishedfileid=0&browsesort=textsearch&section= )
Burryaga  [author] 5 Feb, 2023 @ 6:17pm 
It's conceivable. Would likely require anti-cheats to be disabled. I am more likely to add an ability to walk around the fire eventually. I will simply have to experiment with algorithms for guessing a valid path.
nickodemos 5 Feb, 2023 @ 5:42pm 
Would it be possible that instead of detecting a fire you just make the character 100% fireproof wile your mod is active?
Burryaga  [author] 5 Feb, 2023 @ 7:15am 
Sorry to the countless unknown humanoids who had to die in order to compel technological progress in this field.
Burryaga  [author] 5 Feb, 2023 @ 7:14am 
(Conveniently, you will walk across it if the fire has already burned out, as the mod checks the square ahead for fire, rather than a campfire object, and the game doesn't add a fire object to a campfire unless it's been lit.)
Burryaga  [author] 5 Feb, 2023 @ 7:13am 
@unclefmg While I still do not know of a mod that will walk around a campfire, my mod will no longer make you walk through it. You should find that you now automatically stop if you are approaching any fire object, campfire or otherwise.
unclefmg 5 Feb, 2023 @ 12:21am 
I appreciate your response and, more importantly, you great contributions to the community. Plus, it's nice to know someone understands my burning desire to avoid going up in flames.
Burryaga  [author] 3 Feb, 2023 @ 4:02am 
I guess it's possible I could find a way to at least cancel the autowalk action if it detects a campfire in front of the player, but that is about the best I could likely do for this mod... although maybe I could get creative and try to plot a series of walk-to actions that would navigate around a fire... I will look into it, but it will likely be complicated, so don't expect anything too soon lol.
Burryaga  [author] 3 Feb, 2023 @ 3:58am 
Haha, I am not. This mod uses the vanilla walk-to function, which is amazingly effective in navigating around trees, so I can't help but be pretty surprised that it walks through burning campfires. Sorry about your luck, as that must have been a low-probability path to take, indeed.

I cannot improve the walk-to function in Lua because it is handled by the Java code. Sorry for any disappointment that anyone has with the limitations of the walk-to function in this game. You will either need to advocate for Java modding (which gets a lot of resistance because Java modding of Zomboid would also be less safe for end users), or take it up with The Indie Stone and hope they improve the function someday.