Skip to content

Instantly share code, notes, and snippets.

@kbrandwijk
Created January 3, 2021 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbrandwijk/72da5c016a7c15ff15d32cfb89e52a83 to your computer and use it in GitHub Desktop.
Save kbrandwijk/72da5c016a7c15ff15d32cfb89e52a83 to your computer and use it in GitHub Desktop.
local modDirectory = g_currentModDirectory
function overwriteGameplayHints()
-- remove the existing hints
g_gameplayHintManager.gameplayHints = {}
-- open your own hints xml file
local xmlFile = loadXMLFile("gameplayHints", Utils.getFilename("maps/gameplayHints.xml", modDirectory))
-- loop through all the entries and feed them to the gameplayManager
local i = 0
while true do
local key = string.format("gameplayHints.gameplayHint(%d)", i)
if not hasXMLProperty(xmlFile, key) then
break
end
local text = getXMLString(xmlFile, key)
if text:sub(1,6) == "$l10n_" then
text = g_i18n:getText(text:sub(7))
end
table.insert(g_gameplayHintManager.gameplayHints, text)
i = i + 1
end
-- remove the entry to the xml file
delete(xmlFile)
g_mpLoadingScreen.currentGameplayHints = nil
end
function load(mission)
overwriteGameplayHints()
end
function init()
-- Loading of your own hints needs to happen after the basegame initializes, but before the mission is loaded
Mission00.load = Utils.prependedFunction(Mission00.load, load)
end
init()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment