Skip to content

_Spell API

NellsRelo edited this page Jan 17, 2024 · 4 revisions

To insert or remove to/from Stat Data(Passives, Spells, etc), you have two options, the Config method or directly calling the API

Config

The Compatibility Framework allows you to modify Stats Data - that is, Spells, Passives, Statuses, Armor, Weapons, etc. A big use case for this would be dynamic insertion of data into a Container Spell, as in the below example, but any field that Script Extender is capable of understanding can be changed - as long as you're not trying to edit a Functor, basically.

Even though this is marked as the Spells Module, and the below it encompasses Actions, Passives, Statuses, Armor, Weapons, etc. Any Stats/Generated/Data/ .txt's data can be modified, and it would all be under the "Spells" section of your JSON config.

{
  "FileVersion": 1,
  "Spells": [
    {
      "ID": "Spell to edit",
      "Action": "Insert",
      "ContainerSpells": [
        "Spell to add",
        "Another Spell to Add"
      ]
    },
    {
      "ID": "Shout_DisguiseSelf",
      "Action": "Remove",
      "ContainerSpells": [
        "Spell to Remove",
        "Another Spell to Remove",
        "etc"
      ]
    }
  ],
}

API

The Compatibility Framework contains an API Endpoint to insert and remove Spells into containers.

Adding/Removing Strings

Api.InsertSpellStrings Api.RemoveSpellStrings

Your object will look like this:

MyBString = {
  payload = {
    modGuid = "Your Mod's UUID as defined in meta.lsx",
    Target = "The Spell ID you wish to insert into",
    Type = "ContainerSpells",
    SubSpells= {
      "A Spell ID",
      "Another Spell ID",
    }
  }
}