View Single Post
07/27/15, 04:45 PM   #21
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
The coordinates are tied to the map, so if your wanting coordinates relative to the players actual location, like Votan said:
Lua Code:
  1. SetMapToPlayerLocation()
  2. CALLBACK_MANAGER:FireCallbacks("OnWorldMapChanged")
But if the player has the map open and on a different map it will force the map to change. You could look at LibGPS and see how it saves the map information & then resets it. Then you could just SetMapToPlayerLocation, grab the loc, reset the map where it was & then fire the "OnWorldMapChanged" callback. Or just prevent your code from running when the map is open (if possible).

I think if you got this, I think your map was not updated (maybe you didn't have it on the right map or an addon changed the map on you?):
Lua Code:
  1. GetCurrentMapZoneIndex() = 4294967296
you were either on MAPTYPE_WORLD (the map that shows cyrodill & other zones) or MAPTYPE_COSMIC (tamriel map). I don't have a WP in grahtwood, but moving the map there & using GetCurrentMapZoneIndex() gives me 181, inside the tree is also 181.


The rest may not be useful, they are just random thoughts, but I'm not sure what all your trying to do so I'll just throw it out here anyway:

You can use this to determine which type of map you are on, if you only care about a certain kind: cosmic, world, zone, subzone, exc...
Lua Code:
  1. GetMapType()
  2.    Returns: integer UIMapType mapType

This can tell your map is on a dungeon or ava map:
Lua Code:
  1. local mapContentType = GetMapContentType()

This can tell you some info like if the map was opened for fast travel (wayshrine travel), keep fast travel (clicking wayshrine in a keep), ava respawn map (if you died in ava & need to select a spawn point), exc..
Lua Code:
  1. local mapMode = ZO_WorldMap_GetMode()

Returns ZoneIndex & PoiIndex (if in a POI, includes cities) nillable if not in a POI.
Lua Code:
  1. -- Not dependant on the map:
  2. local zone, poi = GetCurrentSubZonePOIIndices()
  3. -- Get location name of POI I am in (and otherinfo)
  4. local objectiveName, objectiveLevel, startDescription, finishedDescription = GetPOIInfo(iZoneIdex, iPoiIndex)            
  5. -- other info you can get about it:
  6. GetPOIMapInfo(integer zoneIndex, integer poiIndex)
  7.         Returns: number normalizedX, number normalizedZ, integer MapDisplayPinType poiType, textureName icon, boolean isShownInCurrentMap
  8.          
  9. -- Can use the normX & normY returned from GetPOIMapInfo to click it
  10. WouldProcessMapClick(number normalizedClickX, number normalizedClickY)
  11.    Returns: boolean wouldProcess, integer:nilable resultingMapIndex
  12.  
  13. ProcessMapClick(number normalizedClickX, number normalizedClickY)
  14.    Returns: integer SetMapResultCode setMapResult

You said something about having the correct map name: GetPlayerLocationName() is not dependent on the map if you need the correct location name.
Would it help to compare these?
Lua Code:
  1. -- If map is not at players actual location they will be different?
  2. GetPlayerLocationName()
  3. GetMapName()