About this mod
This mod for Nine Sols removes the frustrating mechanic of losing all your money and experience upon death. Your corpse will still appear at the place of death, allowing you to interact with it if you wish, but you will retain all your money and experience, eliminating the need to reclaim them.
- Requirements
- Permissions and credits
In Nine Sols, players face a challenging mechanic where they lose all their money and experience upon death. This can be particularly frustrating in a game known for its difficulty, as it requires players to travel back to their place of death to reclaim their lost resources. If they die again on the way, they lose them permanently. This mod aims to ease this frustration by modifying the death mechanic.
How the Mod Works:
With this mod, when you die, your corpse will still appear at the place of death, allowing you to interact with it if you wish. However, you will retain all your money and experience, eliminating the need to reclaim them. This change ensures that you no longer have to worry about losing your hard-earned resources permanently.
Installation:
- Install BepInEx according to manual in page BepInEx Installation (Download BepInEx x64 and extract it in Nine Sols folder)
- You should have BepInEx folder inside your game folder. Extract mod archive into BepInEx folder, so it should look like
Nine Sols\BepInEx\plugins\NoDeathPenalty.dll
- Run the game and test it. After death you should retain all your money and exp.
string and replace it to
dll_search_path_override=unstripped_corlib
Technical Description
How This Mod Works:
This mod modifies the game's code to change the behavior of the death mechanic in Nine Sols. Specifically, it targets two key methods:
PlayerDeathPenalty
and StorePlayerDataBeforeDead
1. PlayerDeathPenalty Method:
- The original `PlayerDeathPenalty` method sets the player's `CurrentGold` and `CurrentExp` to 0 upon death.
- The mod uses a Harmony Transpiler patch to replace the IL instructions that set `CurrentGold` and `CurrentExp` to 0 with `OpCodes.Nop` (no operation), effectively removing these lines from the execution.
- This ensures that the player retains their money and experience after death.
2. StorePlayerDataBeforeDead Method:
- The original `StorePlayerDataBeforeDead` method stores the player's current experience and money in the `ContainEXP` and `ContainMoney` fields, respectively, when the player dies.
- The mod uses a Harmony Postfix patch to set the `ContainEXP` and `ContainMoney` values to 0 after the original method has executed.
- This prevents the player's ghost from storing any money or experience, eliminating the possibility of doubling resources upon death.
Source code