There is a SetMapToMapId. However, unless the user changes the map manually first, the map will reset to the on map open default after SetMapToMapId is used. Making it almost useless.
I've proposed this.
Lua Code:
function ZO_WorldMap_SetMapById(mapId)
if WORLD_MAP_MANAGER:IsMapChangingAllowed() then
if SetMapToMapId(mapId) == SET_MAP_RESULT_MAP_CHANGED then
g_playerChoseCurrentMap = true
CALLBACK_MANAGER:FireCallbacks("OnWorldMapChanged")
end
end
end
You see, the g_playerChoseCurrentMap must be true in order for the map to not be reset.
Lua Code:
function Update(map, currentTimeS)
-- ... in short
-- If the player is just wandering around the world, with their map open, then refresh it every so often so that
-- it's showing the appropriate location for where they are. If they actually picked a loction, then avoid this update.
if not g_playerChoseCurrentMap then
if SetMapToPlayerLocation() == SET_MAP_RESULT_MAP_CHANGED then
The alternative is to:
Lua Code:
local original_CALLBACK_MANAGER = CALLBACK_MANAGER
local function setMapById(mapId)
-- lets prevent the callback from firing when we only want to set g_playerChoseCurrentMap to true
CALLBACK_MANAGER = {FireCallbacks = function() end}
-- Lets fire this so it will set g_playerChoseCurrentMap to true
ZO_WorldMap_SetMapByIndex(1)
-- Now reset the callback manager
CALLBACK_MANAGER = original_CALLBACK_MANAGER
-- Set map by mapId and fire callback
if SetMapToMapId(mapId) == SET_MAP_RESULT_MAP_CHANGED then
CALLBACK_MANAGER:FireCallbacks("OnWorldMapChanged")
end
end