-
Notifications
You must be signed in to change notification settings - Fork 0
Quick Start
Working settings in five minutes.
Copy these from Native Mod Options' Scripts/ folder into your own mod's Scripts/:
mod_options_client.lua
json.lua
UE4SS mods each run in their own Lua VM and cannot require() another mod's files, so both are
copied per mod rather than shared. This is the same thing you already do with json.lua between
projects.
In your main.lua:
local ModOptionsClient = require("mod_options_client")
local SCHEMA = {
id = "YourMod", -- unique across every installed mod; also your config filename
title = "Your Mod", -- the tab caption players see
options = {
{ key = "sec_main", type = "section", label = "General" },
{
key = "Enabled",
type = "boolean",
label = "Enable the thing",
description = "One short line, shown under the label.",
default = true,
},
{
key = "Strength",
type = "number",
label = "Strength",
default = 0.5,
min = 0, -- required for number
max = 1,
},
},
}
local client = ModOptionsClient.new(SCHEMA)
client:register()-- Correct from your first frame, including the player's saved values. Read it anywhere.
if client.values.Enabled then
doTheThing(client.values.Strength)
end
-- Fires once per changed key when the player presses Apply.
client:subscribe(function(key, value, source)
applySettings()
end)client.values is the single source of truth. Read it at press time rather than caching a copy, and
a rebind or a toggle takes effect without any extra plumbing.
- Deploy your mod and Native Mod Options into the UE4SS
Modsfolder, both enabled inmods.txt. - Launch, open Options → Mod Options, and find your tab.
- Change something, press Escape, and confirm the prompt. Reopen to see it stuck.
UE4SS.log should contain a line like:
[NativeModOptions] Registered 'YourMod' (3 options)
If it does not, your schema was rejected - see Troubleshooting.
examples/Demo is a runnable
mod whose schema uses every option type and modifier, one of each, with a comment on each saying what
it renders as. Copy it, change the id and title, and replace the options.
-
idmust be unique across all installed mods. It is also the name of the file your values are persisted to, so changing it later orphans the old file and resets everyone's settings. -
keymust be unique within your schema, including display-only entries. Bothidandkeymust match^[A-Za-z0-9_.-]+$. -
Keep
descriptionto one short line. Long strings clip in the native row layout. - Nothing commits until Apply. See API Reference for why that is deliberate.
Native Mod Options