Skip to content

Adding a custom Leader Title

Janeene Beeforth edited this page Nov 20, 2018 · 6 revisions

The leader title is one of the first pieces of data that is set in the save game inside OnMsg.NewMapLoaded or OnMsg.LoadGame. This means that any custom titles need to be set prior to those two message functions being triggered.

Martian Tribune now sends a message "MartianTribuneModLoaded" when the mod has been loaded for a game. This gets fired inside OnMsg.ModsReloaded(), and should be safe to use to determine whether MartianTribune has been loaded into a game. It occurs early enough in the startup process that Leader Titles can be set prior to the game data itself being loaded.

function OnMsg.MartianTribuneModLoaded()
    -- Replace XXXX with the translation number.
    MartianTribuneMod.Functions.AddLeaderTitleForSponsor(
        -- Value of GetMissionSponsor().name for that Sponsor.
        "Jedi",
        -- Translated LeaderTitle to use for that Sponsor.
        T{XXXX, "Jedi Master"}
    )
end

Clone this wiki locally