Skip to content

Adding a Subclass to the Compatibility Framework

NellsRelo edited this page Sep 26, 2023 · 1 revision

(This page is deprecated, and will be removed in a future release of the Community Library. It has been moved to this location)

Adding Subclass Compatibility

Getting Started

The Compatibility Framework(CF) makes it easy to make your Subclass compatible with other Subclass mods. There are two options:

  1. Utilizing the Compatibility Framework's Exposed API
  2. Integrating Support into the Compatibility Framework

Using the API is by far the easiest approach, and has many benefits:

  • No need to make Pull Requests to the CF
  • No need to wait for an update to the CF Update for compatibility to work
  • Many mods and mod requirements are already using the Script Extender, so you don't need to worry about "Yet another requirement"
  • SCF support for your mod is entirely under your control - if you make any changes to your Subclass or Mod's UUID, you only need to update them within your mod.
  • The use of CF is optional - your users don't need to install the SCF, as the Support function won't be triggered unless the Subclass Compatibility Framework is installed

For those that wish not to use the Script Extender in their mod, we'll be keeping Integrated support available, as outlined under Integrating Support into CF. As mods switch over to using CF API, we'll phase out their entries in our codebase's integrated support.

Utilizing CF API

To use the CF's API, be sure you have your mod set up for the Script Extender, and then simply paste this into your BootstrapServer.lua and BoostrapClient.lua files:

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",
      subClassName = "English-localized name for your class (Optional)"
    }
  }

  local function OnSessionLoaded()
    Mods.SubclassCompatibilityFramework.Api.InsertSubClasses(subClasses)
  end

  Ext.Events.SessionLoaded:Subscribe(OnSessionLoaded)
end

What this does is, it checks if the SCF 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:

  1. 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.
  2. The UUID of the Progression at which the subclass options for the parent class become available.

subClassName : This field is optional. It will be used for a future sorting feature. Change the value to the English-localized name for your subclass.

Now you're all done! Be sure your mod loads earlier than CompatibilityFramework.

Note: If your mod has multiple subclasses within it, 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",
      subClassName = "English-localized name for your class (Optional)"
    },
    AuthorSubclassB = {
      modGuid = modGuid,
      subClassGuid = subClassBGuid,
      class = "lowercase parent class name or uuid of the progression where you get the subclass choice",
      subClassName = "English-localized name for your class (Optional)"
    },
  }

Be sure to define the additional subclasses UUID.

Clone this wiki locally