Safely removing BG3 mods from an ongoing save
I started my Baldur’s Gate 3 campaign with some cool mods that add new spells, but I’ve decided to remove them for a simpler, more challenging experience.
But it can be dangerous to uninstall a mod from an ongoing campaign. Here’s the workaround I found: modding the mods!
This won’t work with every mod, and it won’t always be as simple as this one. But if you’re dealing with a similar mod, I hope this can at least give you useful ideas for how to approach it!
First, I tried uninstalling the mod
The mods I wanted to take a break from were 5e Spells and Homebrew Spells, both created by DiZ91891. They’re very cool and I enjoyed them a lot! I just wanted to try having fewer and more standard options.
(I also could’ve just ignored these spells… but I preferred the clarity of having them off the screen! Just a lil quality-of-life change.)
But when I tried removing the mods, I found that the game crashed when loading a save file that had been built with them enabled. I tried removing all traces of those spells by reclassing everyone to a Level 1 Fighter, but even that didn’t fix it!
Instead, I kept the mods on, with some features removed
I never figured out what part of the save file still references those spells. Instead, I decided to work around it: keep the spells in the game, but not in the spell lists.
First, I downloaded
lslib
, a collection of utilities for working with Larian Studios’s
proprietary file formats. (They’ve been around since the earliest
Divinity games, and have kept up to date for Baldur’s Gate 3!)
Then, I found the mod’s PAK file in its usual installed location
(if you’re using
BG3 Mod Manager, you can find it under the “Go” menu), and used
lslib
’s
PAK extraction tool to unpack the mod as a folder.
Then, inside the extracted mod folder, I looked in the usual
location for scripts that BG3 mods use to extend game
functionality:
Mods/<mod name>/ScriptExtender/Lua
.
How to do this next part will vary from mod to mod, in the “5e
Spells” case, I found a file inside named
S5E_BootstrapShared.lua
, which runs when the game starts to edit game data. It mainly
edits the class spell lists: adding more spells to learn at Wizard
Level 1 and such.
Then, I found the line of code that actually runs the setup functionality when the game boots:
Ext.Events.SessionLoaded:Subscribe(OnSessionLoaded)
And then I turned it off! The easiest way to do this in Lua is to comment it out:
-- MATCHU EDIT: Don't add the spells to the class lists!
-- Ext.Events.SessionLoaded:Subscribe(OnSessionLoaded)
Finally, I used
lslib
’s
PAK creation tool to repackage the folder as a PAK file, then
backed up the original PAK file, and overwrote it with my
newly-edited copy. This installed my modded mod!
And it worked how I wanted!
When I booted the game again, I saw the outcome I had hoped for and expected! The spells still existed (yay, crash prevention!), but were not generally available anymore:
- When leveling up and choosing spells, modded spells were no longer available.
- For classes that learn all their level’s spells automatically (Cleric, Druid, etc.), modded spells were no longer available in their spellbook.
- Some characters still had access to the modded spells they chose on level-up, like their cantrips, but I was able to remove them by using the game’s built-in functionality to rebuild a character.
I’m quite pleased! I safely disabled just the functionality I wanted, whew!
So, yeah! If you uhh, found this blog post because you were in the same situation I was, I hope this helps! 💖
One last thing
When I turned off that line of code, I actually did this a bit fancier! I added a little note and toggle switch to the top of the file:
-- MATCHU EDIT: When this is `false`, we don't add the spells to the class lists.
local modIsActive = false
Then, at the relevant line of code, instead of commenting it out, I wrapped it in an if-then statement:
if modIsActive then
Ext.Events.SessionLoaded:Subscribe(OnSessionLoaded)
end
That way, I can toggle the mod’s functionality on and off more quickly, and it’s easier for me to notice the edit if I open this file in the future.