Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
SaveYourLuckBruh
Persists vanilla Valheim bad luck protection across game sessions and world transitions.
| Date uploaded | 3 days ago |
| Version | 1.1.1 |
| Download link | Vapok-SaveYourLuckBruh-1.1.1.zip |
| Downloads | 277 |
| Dependency string | Vapok-SaveYourLuckBruh-1.1.1 |
This mod requires the following mods to function
denikson-BepInExPack_Valheim
BepInEx pack for Valheim. Preconfigured with the correct entry point for mods and preferred defaults for the community.
Preferred version: 5.4.2351ValheimModding-Jotunn
Jötunn (/ˈjɔːtʊn/, 'giant'), the Valheim Library was created with the goal of making the lives of mod developers easier. It enables you to create mods for Valheim using an abstracted API so you can focus on the actual content creation.
Preferred version: 2.30.2ValheimModding-YamlDotNet
Shared version 16.3.0 of YamlDotNet from Antoine Aubry and contributors, net47 package for use in Valheim mods. Maintained by the ValheimModding team.
Preferred version: 16.3.1README
🍀 SaveYourLuckBruh
Unifies and fixes vanilla Valheim pseudo-random drop counters so bad luck equity is never fragmented or lost across game sessions, world travels, or star tiers.
In Valheim, rare item drops (such as trophies and rare materials) utilize an internal pseudo-random countdown (s_pseudoCounter) to guarantee drops after a set number of kills.
In Patch 1.0.20, Iron Gate added basic character persistence for this dictionary and attempted to scale trophy drop rates with monster stars. However, their implementation introduced severe mechanical flaws: pity counters are split across star tiers, 2-star enemies are excluded from pity entirely, and the static dictionary leaks across characters on the character select screen.
SaveYourLuckBruh fixes these issues by unifying pity progression across all star tiers, isolating character saves from menu preview leaks, preserving per-world progression, and protecting your pity counters in co-op.
🎯 The Problem with Vanilla 1.0.20
In Patch 1.0.20, Iron Gate made two major changes to CharacterDrop:
- They serialized
CharacterDrop.s_pseudoCounterinto the.fchcharacter save file. - They allowed monster star levels to multiply trophy drop chances.
While this addressed the basic issue of counters resetting on logout, their implementation created three critical problems:
1. Star-Level Pity Fragmentation
Iron Gate changed the dictionary key to a compound hash: hash(prefabName) + (chance * 1000). Because chance scales with star level (0-star = 10%, 1-star = 20%, 2-star = 40%):
- A 0-star Cultist and a 1-star Cultist write to completely different dictionary entries.
- Kills on 0-star and 1-star enemies do not pool together. If you kill 8 0-stars and 2 1-stars, neither counter advances the other.
- Because 2-star Cultists have a 40% drop chance, they exceed vanilla's 30% cutoff (
chance <= 0.3f). 2-star enemies are completely disqualified from pseudo drops. They do not advance pity, and if a 2-star drops a trophy, your 0-star counter does not reset—giving you an unintended duplicate drop shortly after.
2. Static Memory Leak / Cross-Character Pollution
CharacterDrop.s_pseudoCounter is a static dictionary. In Player.Load, vanilla inserts saved entries without ever calling .Clear(). Because Player.Load is executed during character preview in the main menu, cycling through characters on the start screen merges all their counters together into memory. Whichever character you launch into the world inherits the combined counters of every previewed character.
3. Multiplayer ZDO Attribution & World Bleed
Only the network owner of a creature's ZNetView executes drop calculations. In co-op, an ally landing a kill can consume your personal countdown. Furthermore, vanilla counters are tied globally to the character file with zero world scoping, allowing players to farm pity in local worlds and cash it in on multiplayer servers.
💡 The Solution
| Feature | Vanilla 1.0.20 Behavior | SaveYourLuckBruh Behavior |
|---|---|---|
| Unified Star Pity | Star tiers have separate counters; 2-star mobs excluded. | All star tiers advance a single unified pity counter per item. |
| Star Difficulty Weighting | 1-star kills advance 1-star counter by 1. | 1-star kills count as 2 progress; 2-star kills count as 4 progress. |
| 2-Star Guarantee | 2-star mobs cannot trigger guaranteed bad luck drops. | 2-star mobs advance pity and trigger guaranteed drops if threshold is hit. |
| Counter Reset on Drop | Dropping a trophy on a 1-star mob leaves 0-star counter intact. | Any drop of the target item from any star tier resets the unified counter. |
| Character Select Isolation | Previews in the main menu merge counters across characters. | Clears static dictionary in menu; keeps characters fully isolated. |
| World Isolation | Counters are global across all solo and server worlds. | Stores per-world snapshots in Player.m_customData scoped by World UID. |
| Co-op Attribution | Host/ZDO owner loses pity counter regardless of killer. | Preserves local player's pity counter when allies make the kill. |
⚙️ Configuration
SaveYourLuckBruh is an install-and-forget mod. It requires no functional configuration to work.
Standard logging settings are available in BepInEx/config/vapok.mods.SaveYourLuckBruh.cfg:
- Enable SaveYourLuckBruh: Master toggle to enable or disable mod functionality.
- Enable Debug Mode: Logs real-time counter changes, star weight calculations, resets, and attribution in
LogOutput.log.
🤝 Compatibility & Requirements
- Valheim: 1.0.20 or later.
- BepInEx: 5.4.2351 or later.
- Jotunn: 2.30.2 or later.
- Client-Side Only: Does not need to be installed on dedicated servers. Works in singleplayer and multiplayer.
🔌 For Mod Developers & AI Coding Agents
- 🤖 AI Agent Rules & Invariants: Technical guidelines and repository invariants.
- ⚠️ Integration Policy: SaveYourLuckBruh is a self-contained mod without a public API. Do not use reflection or Harmony patches on internal classes.
- 💡 Feature Requests: Report bugs or suggest features on GitHub Issues or in Discord.
CHANGELOG
1.1.1 - Dependency Updates & Valheim 1.0.20 Alignment
- Compatibility: Updated internal dependencies for stability and Valheim 1.0.20 compatibility.
1.0 Changelog History (Valheim Release) (click to expand)
1.1.0 - Unified Star Pity & Game Compatibility
- Valheim 1.0.20 Support: Updated for compatibility with the latest game patch.
- Unified Star Progress: Enemies with 0, 1, or 2 stars now share the same bad luck counter for rare trophy drops instead of splitting your progress.
- Star Enemy Bonus: Defeating stronger star enemies advances your bad luck counter faster.
- Character Isolation: Fixed a vanilla game issue where browsing characters on the main menu mixed up their bad luck progress.
1.0.3 - Dependency Updates & Stability
- Updated internal dependencies for stability.
1.0.2 - Compatibility Stability
- Compatibility Stability: Updated dependencies for third party mod compatibilities.
1.0.1 - Compatibility & Patch Sequencing
- Updated startup initialization to ensure patch sequencing aligns properly with internal helper libraries.
1.0.0 - Initial Release
- Persistent Bad Luck Protection: Rare drop countdowns now save directly to your character, preventing progress from wiping when you close the game.
- World-Scoped Tracking: Drop countdowns are saved separately for each world, keeping your solo and multiplayer progress isolated.
- Zero Configuration: Functions out of the box with no extra settings or setup required.
- Dependencies: Built with Jotunn 2.30.2 for Valheim 1.0.16.
