Using the Api - BG3-Community-Library-Team/OathFramework GitHub Wiki
Once your Custom Paladin Subclass has been registered, all that's left is listening for events that should cause an Oath to Break or Redeem, and then calling the Modify Oath API function.
You'll need to utilize Script Extender to create Osiris Listeners, watching for events that you will then provide logic to in order to determine if the conditions are met or not. Once the conditions are met, you need a few things things: any IDs for required mods, the relevant Character's ID the relevant Subclass Tag, and whether you want it to be a Break
or Redeem
event. Pass those in to Mods.OF.API.ModifyOath()
like so:
Mods.OF.Api.ModifyOath({
modGuids = { "UUID of required mod", "Possible UUID of additional mod" },
CharacterId = "UUID of character completing the event",
SubclassTagId = "Name_UUID of Subclass Tag (ex. PALADIN_ANCIENTS_7c89622b-4194-41df-b2ff-145a5056ee49)"
EventType = "Break or Redeem"
})
An example of this in practice might look like this:
-- Defining our mod's UUID for ease of access when we call the API
ModuleUUID = "7c89622b-4194-41df-b2ff-145a5056ee49"
-- Osiris Listener for a Flag being set
Ext.Osiris.RegisterListener("FlagSet", 3, "after", function (flag, _, dialogInstance)
-- If the Flag set equals the flag for the Hag being given mercy, then...
if flag == "HAG_Hag_State_HagGivenMercy_a3c0a36a-ccce-4f35-7b54-9ab22d6ac534" then
-- Loop through the characters within the specific dialog instance
for _, character in pairs(Osi.DB_DialogPlayers:Get(dialogInstance, _) do
-- If the character found is tagged as a Devotion Paladin and a Paladin...
if IsTagged(character[1], "PALADIN_DEVOTION_2de0a4fc-5831-4439-94d3-a7ff9b7aacf6") and
IsTagged(character[1], "PALADIN_6d85ab2d-5c23-498c-a61e-98f05a00177a") then
-- Call the Oath Framework API passing in our mod's UUID, the character ID, their subclass tag, and whether to Break or Redeem them.
Mods.OF.Api.ModifyOath({
modGuids = {ModuleUUID},
CharacterId = character[1],
SubclassTagId = "PALADIN_DEVOTION_2de0a4fc-5831-4439-94d3-a7ff9b7aacf6",
EventType = "Break"})
end
end
end
end)