Adding a Subclass to the Compatibility Framework - BG3-Community-Library-Team/BG3-Compatibility-Framework GitHub Wiki
Adding Subclass Compatibility
Getting Started
The Compatibility Framework(CF) makes it easy to make your Subclass compatible with other Subclass mods. So easy, in fact, that it's entirely automatic (for Subclasses)! As of version 2.6.5.8, All you need is a valid ClassDescription entry with a ParentGuid value pointing to the ClassDescription node for its parent class, and CF will do the rest.
If you wish to remove a Subclass from a class (Implemented in 2.7.0.0), you may pick one of the following methods:
- Utilizing the Compatibility Framework's Configuration-Loading method (Preferred)
- Utilizing the Compatibility Framework's Exposed API
Removing Subclass with JSON Configuration Files (Preferred)
To use the CF's Configuration file method, you'll need to do the following:
- In your mod's Workspace, under
Mod/ModName/, create aScriptExtenderfolder if it doesn't already exist. - In the newly-created
ScriptExtenderfolder, create a new file,CompatibilityFrameworkConfig.json.
Now copy the following into CompatibilityFrameworkConfig.json:
{
"FileVersion": 1,
"Progressions": [
{
"UUID": "UUID for the Main Class' Progression at the level at which subclasses are available - use this or UUIDs, but not both",
"UUIDs": ["first-class-progression-uuid", "second-class-progression-uuid"],
"Subclasses": [
{
"Action": "Remove"
"UUID": "your-subclasses-class-description-uuid - use this or UUIDs, but not both",
"UUIDs": ["first-subclass-class-description-uuid", "second-subclass-class-description-uuid"],
"modGuid": "UUID Of Mod required for Insertion (Optional - defaults to the one that provides the config)"
}
]
}
]
}
Removing Subclass with CF API Directly
To use the CF's API, be sure you have your mod set up for the Script Extender. Adjacent to your BootstrapClient.lua and BootstrapServer.lua files, create a file titled InitCompatabilityFramework.lua. In your BoostrapClient.lua file, paste the following:
Ext.Require("InitCompatabilityFramework.lua").
Now paste this into your InitCompatabilityFramework.lua file:
modGuid = "your-mods-uuid-in-metalsx"
subClassGuid = "your-subclasses-class-description-uuid"
if Ext.Mod.IsModLoaded("67fbbd53-7c7d-4cfa-9409-6d737b4d92a9") then
local subClasses = {
AuthorSubclass = {
modGuid = modGuid,
subClassGuid = subClassGuid,
class = "lowercase parent class name or uuid of the progression where you get the subclass choice"
}
}
local function OnStatsLoaded()
Mods.SubclassCompatibilityFramework.Api.RemoveSubClasses(subClasses)
end
Ext.Events.StatsLoaded:Subscribe(OnStatsLoaded)
end
What this does is, it checks if Compatibility Framework is installed by your user. If it is, it builds an object containing your Mod's UUID, your Subclass' UUID, the Parent Class, and a localized version of your Classes name. You'll need to make 4 changes here:
AuthorSubclass: Replace the part before the = with your username and the name of the subclass. Example: FeriatHexblade. These can be shortened.
modGuid: Change the value to your Mod's UUID as defined in meta.lsx.
subClassGuid: Change the value to your Subclasses UUID as defined in ClassDescriptions.lsx.
class: This can be one of two things:
- The lower-case name of your classes Parent class. This will typically be one of the following:
barbarian,bard,cleric,druid,fighter,monk,paladin,ranger,rogue,sorcerer,warlock,wizard. - The UUID of the Progression at which the subclass options for the parent class become available.
Now you're all done! Be sure your mod loads earlier than CompatibilityFramework.
Note: If your mod has is removing multiple subclasses, you'll want to add an additional object to your subClasses table, like so:
local subClasses = {
AuthorSubclassA = {
modGuid = modGuid,
subClassGuid = subClassAGuid,
class = "lowercase parent class name or uuid of the progression where you get the subclass choice"
},
AuthorSubclassB = {
modGuid = modGuid,
subClassGuid = subClassBGuid,
class = "lowercase parent class name or uuid of the progression where you get the subclass choice"
},
}
Be sure to define each subclasses UUID.