Glad it works for you.
If you want to use other frames instead of UIParent as the reference frame, just do it.
If you want to make this conditional, put the condition into the hooked function. Like this:
Lua Code:
hooksecurefunc("GameTooltip_SetDefaultAnchor", function(tooltip)
if MiniMap and MiniMap:IsShown() then
tooltip:SetPoint("TOPRIGHT", MiniMap, "TOPLEFT", -10, 0)
else
tooltip:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -500, 500)
end
end)