Skip to content

Creating Mods

offthew edited this page Apr 28, 2022 · 1 revision

Table of Contents

config.json

Each mod require a configuration file. This file must exist in the path of your mod (Example : mods/testMod/config.json). In the file is not here the mod won't be loaded

Field Description Required
name Mod name. A string that is supposed to uniquely identify your mod, and shouldn't change as you release updates to it. ✔️
version Mod Version ✔️
description Main Description for the mod
secondDescription Second Description used to display mod infos
modApiVersion Minimum version of the mod loader the mod requires to work Not Implemented Yet
dependencies A list of mods Name that will be needed to be run before our mod Not Implemented Yet

Example:

{
  "name":"myModExample",
  "version":1.18,
  "description":"Main Description",
  "modApiVersion":0.1,
  "dependencies":["firstModToLoad","secondModToLoad"]
}

main.lua

Each mods require a main.lua, this is the file that'll run our code. The Mod Loader work in a very simple way. On init (after require_core has been called) the mod loader will run our main.lua. Then when the game loads all the specific game objects (after require_specific has been called) the mod loader will load our load() function. Basically if you wanna edit game titlescreen or core functions, you won't need to encapsulate your code in load() (This might change and core functions might end being called in an init() function) but if you want to edit/create monsters/skills/maps etc... then you'll need to put your code in load()

Each main.lua requires a function load()

Example:

local t = {}
--Init here
modApi.log:write("This mod was Initialized")
function t:load()
  modApi.log:write("This mod is getting loaded")
  modApi.pauseMenu:addPauseButton("ButtonName","RequirePath")
end

return t
Clone this wiki locally