Getting started with UI

Creating the mod file

terrorsoul Beginner General Modding

Let's start by creating the basic structure of the mod, head on over to the Trailmakers mods folder on your pc; an easy way to get here is to right click on Trailmakers in steam library and then click on properties > installed files > browse > mods.


Once you are in the mods folder go ahead and create a new folder, let's call it MyUIMod, then within this newly created folder you will also create a main.lua file. Next open the main.lua file in an code editor such as Visual Studio Code and then copy and paste this basic mod structure into the file and continue to the next step.

-- This is your main mod file.
-- The game will run the 'OnModLoaded' part when your mod starts.

function OnModLoaded()
    -- We'll put our UI instructions here!
    -- For now, let's just make a note that the mod started.
    -- (This message only appears in the local logs, not on screen for players)
    tm.os.Log("My UI Mod is ready!")
end

OnModLoaded()
function OnPlayerJoined(player) -- We'll add UI things for new players here later. end -- This tells the game to run our 'OnPlayerJoined' function when someone new joins. tm.players.OnPlayerJoined.add(OnPlayerJoined)

Discussion

Please log in to post a comment.