Project Zomboid

Project Zomboid

Not enough ratings
Mutie's Loot Scrounging
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
353.204 KB
29 Jul, 2024 @ 3:27pm
3 Feb @ 2:49pm
4 Change Notes ( view )

Subscribe to download
Mutie's Loot Scrounging

Description
Functionality

This mod was intended to replace the vanilla Loot Respawn mechanic entirely, with a character-driven and somewhat narratively reasonable system.

Whenever you approach a piece of furniture in the game, this mod checks if that furniture is outside a faction's Safehouse, if that furniture is Unlocked, and if that furniture was Not Built by a Player. If all three checks succeed, the mod checks how long ago it is since this piece of furniture was last scrounged - furniture that was never scrounged is updated to have a timestamp of "Now" to avoid double-spawning loot with the game's normal loot generation system.

If the scrounge was long enough ago (72h by default), then one or more dice are cast based on player skill to determine if the furniture should generate new loot now. Several players can also approach the same piece of furniture to roll their dice, in case the previous attempts failed. The scrounge timestamp is only updated on a successful attempt. There is also a secondary duration (144h by default) where everyone will automatically scrounge the furniture, even if they have tried before, to force loot to respawn.

All settings like when scrounge attempts are possible, how likely an attempt is to succeed, and how many dice a player at 0 and 10 skill should get are adjustable as Sandbox Options. There is also an optional setting to disable scrounging in a zone where anyone has built anything - similar to vanilla. Do note that this means someone placing a temporary bed or barricade in a shop permanently means that shop won't respawn loot.

There is also a "Weight Threshold" in the Sandbox Options, which is used to remove old loot until the threshold to ensure there is space for new loot, and to dissuade players from just dropping everything on the floor in order to make new loot spawn. The default threshold of 0.2 means that any loot taking up more than 20% of a furniture's capacity will be removed before new loot is generated. Removal of items is randomly ordered until we get under the threshold.

The loot generation algorithm is a re-implementation of the one used by the base game in Java, so it may have bugs, but it should be completely under the same control as the vanilla game, meaning you'll find ammo next to guns, half-empty bottles or batteries, and appropriate items in appropriate shelves and cupboards. Please note that the vanilla game randomly determines if a cupboard is a "canned goods" cupboard or a "cookware" cupboard randomly at loot generation time, so this mod may add canned goods to a cupboard that was previously used for cookware - this is not something I can fix.

Compatibility

Using this on an existing world lacks the necessary info to determine if furniture was built by a player and may respawn and delete loot in player-built furniture. Please be careful when using this on an existing world, or enable the sandbox option to block scrounging in built areas.

This mod uses the vanilla loot generation algorithm re-implemented in Lua, and should as such be compatible with any mods that alter or add to the vanilla loot distributions, as it reads from these distributions and rolls the appropriate dice and modifications for that.

There are currently no known compatibility issues, but it does rely on building mods correctly using a vanilla "setHaveConstruction" function to avoid respawning player-built furniture.

Translation

Currently, the mod only has translations for English.

Upcoming

  • Support for Mod Options to enable/disable XP gain and scrounging success texts. Currently the mod doesn't alert you when you find anything or gain XP.

Promotion

Also check out my other mods:
Mutie's Bait Tooltips
Mutie's Context Menu Icons
Mutie's Diary
Mutie's Evolved Recipe Tooltips

[ko-fi.com]




This work is MIT Licensed[opensource.org]

Workshop ID: 3299408667
Mod ID: MutiesLootScrounging
9 Comments
Mutie  [author] 3 Feb @ 12:14pm 
Bug fix for disappearing items should be out now. Also fixes some furniture not respawning correctly as I was checking time since last scrounge poorly.
Gleg 1 Feb @ 11:57am 
Most items seem to vanish from inventory immediately after looting in multiplayer. I retested on a fresh server install with just this mod.

I'm able to pick up the loot that first exists in containers, but 99% of the loot that generates afterward from the scrounging mod vanishes within 1-4 seconds of transferring to my inventory.
Lord Accokstorm 11 Aug, 2024 @ 4:44pm 
Great! My worries are settled then, this game has so much performance issues even with little mods when i install a new mod I'm always worrying about the fps drop
Mutie  [author] 11 Aug, 2024 @ 3:48pm 
@Jold, it's a very simple test that runs once every second. It checks every container around you and is about as performance intensive (during that one particular second) as the vanilla system for checking inventories in general.

When it generates loot, presumably it's a bit heavier to run, but it's quite simple code with minimal looping, so I doubt it's a noticeable problem.
Lord Accokstorm 11 Aug, 2024 @ 1:07pm 
Great idea, i'm all for immersive mods like this.
However i gotta worry about performance if i understood correctly the mod is checking on proximity and periodically for loot right, so don't these constant checks slow the game?
Mutie  [author] 8 Aug, 2024 @ 11:52am 
@Wrench In The Plan
Building/placing a furniture piece disables respawns forever. There's a sandbox option for this mod to still allow scrounging in places with placed furniture (but that risks respawning/despawning player placed objects, so I suggest marking your base as a safehouse, or manually placing down furniture, which is always protected from scrounging).

Vanilla loot respawn is always blocked from anywhere you place a construction. Note that vanilla loot respawn does not need to be on for scrounging to work. The mod is intended as an alternative to vanilla loot respawn.
Wrench In The Plan 8 Aug, 2024 @ 11:40am 
I don't play with loot respawn but might start my next game with this. If one later removes a construction, does that re-enable scrounging, or does just building a barricade/placing a furniture piece permanently disable it for ever?
Mutie  [author] 4 Aug, 2024 @ 1:45am 
@rawgu, Scavenging Skill provides extra loot based on your skill. Scrounging rolls the loot table again (and removes items over a certain weight threshold, configurable in Sandbox options). Crucially, Scavenging is (to my knowledge) once per container, and Scrounging is repeatable after a delay (set in Sandbox options).
rawgu 4 Aug, 2024 @ 1:14am 
hi, what is the difference between this and scavenging skill? :lunar2019piginablanket: