Skip to content

Part 1. Getting Started

rvIceBreaker edited this page Dec 8, 2021 · 1 revision

This page will walk you through a simple example for ModConfig

Setup a Mod Controller

The key to registering with ModConfig is to implement the IModConf_ControllerSettings blueprint interface in a mod controller.

  1. Create a Mod Controller, and edit it
  2. In the Class Settings panel, add the IModConf_ControllerSettings interface under Implemented Interfaces
  3. Compile the mod controller blueprint

You should now be able to see the GetModSettings function in your mod controller.

Register with ModConfig

GetModSettings is where we register some basic information, as well as the individual settings for our mod.

To start, we'll just provide ModConfig with some basic information from the GetModSettings function.

  1. Edit the GetModSettings function in your controller
  2. Add a Construct Mod Object node
  3. Enter some information about your mod, such as its name and version number
  4. Send the output from Construct Mod Object to the return value of GetModSettings
  5. Compile the mod controller

The Mod Object is a container for all of the setting data your mod should register. Additional functions will modify this object before it is returned from GetModSettings, so you may want to store this as a local variable, or use reroute nodes to keep your function organized.

You can return the Mod Object without any further modification to simply register it with ModConfig and provide no settings to be modified. This can be handy if you just want to let users know that your mod is loaded.

You can build your mod and test it now if you like.

note: Because the Conan DevKit doesn't load mods, you can't actually test ModConfig in the editor. At the time of writing, you have to build your mod and load it in the client game to see its effects. I'm looking into solutions to this.

Add a Control

At this point your mod controller is informing ModConfig that your mod exists, but you're not supplying anything useful yet.

Before we get into modifiable settings, lets just send some static information to the user.

The String Label and Multi String Label controls are useful for this. They can either display completely static text, or you can build dynamic text or values by using string or text manipulation nodes.

  1. Add a Add Setting String Label node
  2. Add a Mod Append Setting node
  3. Link the two Setting Object pins
  4. Link the Mod Object pin to your variable or Construct Mod Object node
  5. Send your mod object variable or Construct Mod Object pin to the return value of GetModSettings

Mod Append Setting is a universal node that will add the Setting Object of any Add Setting... node into the supplied mod object. This workflow is how we build up our setting structure and definition for ModConfig to consume and display to the user.

Settings are displayed in the order they are added in GetModSettings. Play around with the flow of your code to keep things organized and readable.

In the Add Setting String Label node, set the control name, the label text, value to some static values. You can also set the tooltip text if you want.

You can read more about settings controls here

Build your mod and test it.

Conclusion

This covers the basics of interfacing with ModConfig. This is the general workflow of how settings objects are built and sent from GetModSettings

You can continue to the next article to dive into receiving settings changes, and some basic concepts behind client and server data.

Clone this wiki locally