IncantationsAPI
Developer library for adding new incantations
Screenshots 1 screenshots
About this mod Author’s original text
This is an library to make it easy for developers to add new incantations. It does nothing by itself. You should only install it if another mod requires it.
Developer API Documentation
Quickstart
This guide assumes you're writing a mod based on Hell2Modding/ModUtil. You can check out the Hades2ModTemplate or my other mods for examples.
- Add a dependency to "BlueRaja-IncantationsAPI-1.0.0" to your dependency list in manifest.json
- In main.lua, add the lines
--@module 'BlueRaja-IncantationsAPI'
Incantations = mods['BlueRaja-IncantationsAPI']
`
- In ready.lua, call Incantations.addIncantation(params). See below for details.
- _(If you are not using SGG_Modding-ReLoad, meaning you don't have a ready.lua, then it must be called inside of a ModUtil.once_loaded.game() call)_
Methods
Incantations.isIncantationEnabled(id)
Returns true if the incantation has been purchased by the player; false otherwise.
Parameters:
- id (string) - The same ID passed to addIncantation
Incantations.addIncantation(params)
Adds a new incantation. This method _must_ be called at the start of the time, ie. in ready.lua or inside a ModUtil.once_loaded.game() call.
Parameters:
- params (table) - A table containing the following key-value pairs
- Id (string) (required) - A unique internal ID to reference this incantation by. I'd recommend prefacing it with your username to avoid conflicts. It will not be shown to the players.
- Name (string|table) (required) - The name displayed in the cauldron. Can be either a constant string or a translation table _(see below)_.
- Description (string|table) (required) - The description shown when hovering over the incantation in the cauldron. Can be either a constant string or a translation table _(see below)_.
Descriptions can also contain escape sequences that render special things. Some examples:
- {#Emph} - Causes the following text to be bold. There are other text-formats, which you can find by searching for {#. A particularly special one is {#Prev}, which acts as the closing tag, bringing you back to the previous format.
- {!Icons.GiftPoints} - Will render an image of a Nectar, as well as a box along the side of the screen explaining what "Nectar" is. There are many other icons as well, which you can find by searching for {Icons.. You should use an icon any time you reference a resource (bones, plants, etc) in the description.
- {$Keywords.CharArachne} - Will display "Arachne" in a special color, along with a box along the side explaining who that is. You should use {$Keywords.Char sequences whenever you reference a character in the description. There are also ones for locations, eg. {$Keywords.WellShop} will display "Well of Charon" + the help box.
- FlavorText (string|table) (required) - The flavor text shown in italics below the description when hovering over the incantation in the cauldron. Can be either a constant string or a translation table _(see below)_.
- WorldUpgradeData (table) (required) - The information about the incantation, in the same format as the entries in WorldUpgradeData.lua. This includes cost, requirements, icon, voice lines, etc. _(see below)_.
- OnEnabled (function) (optional) - A function to be called when the incantation is enabled, it when the incantation is first purchased, and also whenever the save file is loaded. The function passed in can optionally take two parameters, in this order:
- source (string, either "load" or "purchase") - Whether the function is being called due to a save file loading ("load") or the incantation being purchased ("purchase").
- incantationId (string) - The ID of the incantation being enabled.
WorldUpgradeData
The WorldUpgradeData passed into addIncantation takes the same format as the entries in WorldUpgradeData.lua. There are dozens of possible properties to choose from, but here are the most important ones:
- Icon (string) - The path to the icon to display on the cauldron screen.
You can find the paths and images by using th
Install & use Install: follow the bundled instructions
- Unzip the archive from playbuff and read the bundled readme / instructions first.
- Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
- For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
- Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.
Install locations vary a lot between mods — the bundled readme is the most reliable guide. Hades II uses the game's built-in mod import — unzip the pack and place it where the readme says.
Install these first, or the mod will not work: