Originally Posted by Mitsarugi
Nice thanks, any idea how to set it to specific coordinates? like the "Show on map" feature does for quests?
|
Functions for quests (not usable in this case):
Lua Code:
SetMapToQuestCondition(questIndex, stepIndex, conditionIndex)
SetMapToQuestZone(questIndex)
We have to work with ZO_MapPanAndZoom, but I did not try it yet.
What is worth of trying:
Lua Code:
g_mapPanAndZoom:PanToPin(pin)
g_mapPanAndZoom:JumpToPin(pin)
g_mapPanAndZoom:JumpToPinWhenAvailable(findPinFunction)
--slightly modified version of ZO_MapPanAndZoom:GetPinFocusZoomAndOffset(pin) function
--locX and locY are numbers between 0 and 1, same as used for creating map pins.
local function GetOffset(locX, locY)
local minCoordNX = locX < 0.5 and locX or (1 - locX)
local minCoordNY = locY < 0.5 and locY or (1 - locY)
local minCoordN = zo_min(minCoordNX, minCoordNY)
local targetZoom = g_mapPanAndZoom.maxZoom
local zoomedNX = locX * targetZoom
local zoomedNY = locY * targetZoom
local borderSizeN = (targetZoom - 1) / 2
local offsetNX = 0.5 + borderSizeN - zoomedNX
local offsetNY = 0.5 + borderSizeN - zoomedNY
offsetNX = zo_clamp(offsetNX, -borderSizeN, borderSizeN)
offsetNY = zo_clamp(offsetNY, -borderSizeN, borderSizeN)
local offsetX = offsetNX * ZO_WorldMapScroll:GetWidth()
local offsetY = offsetNY * ZO_WorldMapScroll:GetHeight()
return offsetX, offsetY
end
local offseX, offsetY = GetOffset(locX, locY)
local tagetZoom = g_mapPanAndZoom.maxZoom --minZoom, maxZoom, by default number between 1 and 5.
--jump to target
g_mapPanAndZoom:SetCurrentOffset(offsetX, offsetY)
g_mapPanAndZoom:SetCurrentZoom(targetZoom)
--pan to target
g_mapPanAndZoom:SetTargetOffset(offsetX, offsetY)
g_mapPanAndZoom:SetTargetZoom(targetZoom)
g_mapPanAndZoom:SetFinalTargetOffset(offsetX, offsetY, targetZoom)
--custom zoom:
g_mapPanAndZoom:SetCustomZoomMinMax(minZoom, maxZoom)
g_mapPanAndZoom:ClearCustomZoomMinMax()
g_mapPanAndZoom:GetCurrentZoom()