Project Zomboid

Project Zomboid

Sushikami Feb 27, 2023 @ 3:45am
Project Zomboid: Loot Respawn Mechanics
Currently there are a few settings in both the config.ini and sandboxvars.ini files that may affect the loot respawn mechanics for PZ Servers:

From config.ini
- HoursForLootRespawn
- MaxItemsForLootRespawn
- ConstructionPreventsLootRespawn

From sandboxvar.ini
- LootRespawn
- SeenHoursPreventLootRespawn

I'd like to start with ConstructionPreventsLootRespawn to get it out of the way as it is pretty much straight forward. A container will not respawn loot if a player constructs anything within its zone.

A zone is a fixed grid location within the map. The grid size depends on how big the town zone the developers have set (this goes for mod maps as well). This is not a chunk as a chunk is any 20x20 cell area that moves with the player.

MaxItemsForLootRespawn: Also straight forward. The container will not respawn items if there's an X amount of items stored inside.

Now on to the tricky settings. The notes found in the config files are confusing! So I set out to investigate the underlying code to check how it really works.

HoursForLootRespawn: based on the note is a recurring timer in in-game-hours that respawns loot in ALL containers in the world. Followed by "Loot respawn is not impacted by visibility or subsequent looting". But not really. The container needs to have been looted first before that container is included in the list of containers that get their contents respawned. more on this below!

LootRespawn: Items will respawn in already-looted containers depending on the set time denoted by a value from 1-5 (YES THE CODE SUPPORTS UP TO VALUE 5 (every 2 months) when the notes only have up to 4!). more on this below!

SeenHoursPreventLootRespawn: functionality is straight forward, but tough to discern as there's no way for you to exactly know where a container's zone perimeter is relative to your player chunk. Best case is to leave the town completely. This will govern if a container is allowed to respawn loot based on when the last time a player is within the zone the container is inside of. (i.e. if this setting is set to 10 hours, then no one must be within the container's zone 10 hours before the scheduled loot respawn).

So how are these settings related, especially when these settings are on different config files? I want you to disregard whatever the note says in the config file. Apparently HoursForLootRespawn and LootRespawn are the same! It just depends on whether the config file is loaded as a server or a solo game respectively.

So if you're a server owner/admin use HoursForLootRespawn to set the loot respawn timer. Any value set in LootRespawn will be ignored by the server. The rest of the settings: MaxItemsForLootRespawn, ConstructionPreventsLootRespawn & SeenHoursPreventLootRespawn will apply as is.

Let me know if there's anything that needs to be clarified.

Source: Decompiled LootRespawn.class from the game files and interpreted the code.
Last edited by Sushikami; Feb 27, 2023 @ 4:48am
< >
Showing 1-7 of 7 comments
real hideo kojima Feb 27, 2023 @ 3:47am 
congratulations on your decision
DarkknighT@ Apr 16, 2023 @ 10:11am 
Which settings i have to set, to get every 24 ingame hours new loot like magazines, books or food?
We emptied all shops but nothing is going to spawn again? No settings we tried for now is working...
Sushikami Apr 17, 2023 @ 10:39am 
Originally posted by DarkknighT@:
Which settings i have to set, to get every 24 ingame hours new loot like magazines, books or food?
We emptied all shops but nothing is going to spawn again? No settings we tried for now is working...

If you're playing on a server, set the desired ingame hours in HoursForLootRespawn found in the config.ini file. You might wanna set SeenHoursPreventLootRespawn to "0" as well, so that as soon as you leave the container's map chunk, it automatically respawns on next map chunk load (i.e. you still need to leave the the container's map chunk first before the loot can respawn. Sometimes this might mean leaving the town, and then going back to it).
DarkknighT@ Apr 18, 2023 @ 5:28pm 
Originally posted by Sushikami:
Originally posted by DarkknighT@:
Which settings i have to set, to get every 24 ingame hours new loot like magazines, books or food?
We emptied all shops but nothing is going to spawn again? No settings we tried for now is working...

If you're playing on a server, set the desired ingame hours in HoursForLootRespawn found in the config.ini file. You might wanna set SeenHoursPreventLootRespawn to "0" as well, so that as soon as you leave the container's map chunk, it automatically respawns on next map chunk load (i.e. you still need to leave the the container's map chunk first before the loot can respawn. Sometimes this might mean leaving the town, and then going back to it).

Ok. I tried it. And it didn't worked. I have no clue anymore. I tried a lot of settings but nothing works -.-

This option is only available in the servertest_sandboxvars.lua file at g-portal.
Last edited by DarkknighT@; Apr 19, 2023 @ 4:30am
Sushikami Apr 25, 2023 @ 9:53am 
Originally posted by DarkknighT@:
Originally posted by Sushikami:

If you're playing on a server, set the desired ingame hours in HoursForLootRespawn found in the config.ini file. You might wanna set SeenHoursPreventLootRespawn to "0" as well, so that as soon as you leave the container's map chunk, it automatically respawns on next map chunk load (i.e. you still need to leave the the container's map chunk first before the loot can respawn. Sometimes this might mean leaving the town, and then going back to it).

Ok. I tried it. And it didn't worked. I have no clue anymore. I tried a lot of settings but nothing works -.-

This option is only available in the servertest_sandboxvars.lua file at g-portal.

Regardless of host, you should also be able to change this particular setting from the ingame Admin Panel, and then simply search for "HoursForLootRespawn" from the list of setting parameters. The change will apply automatically while the game is running.
SodoMaster Apr 6, 2024 @ 5:37pm 
Hi, I have a question: if I don't want any loot to respawn what settings do I change and what value do I put in said setting? is it HoursForLootRespawn? (I am in a hosted server)
Raven_1974 Apr 8, 2024 @ 8:30pm 
Does the items left/ stored in the container get removed and replaced with new items to loot ? Or the new items get added on top of the existing/ left items in the container ?
< >
Showing 1-7 of 7 comments
Per page: 1530 50

Date Posted: Feb 27, 2023 @ 3:45am
Posts: 7