Thread Tools Display Modes
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()
 
07/27/15, 04:58 PM   #22
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by XanDDemoX View Post
I had a similar problem, needing to resolve zoneIndex within a city map within my addon.
Maybe I missunderstand what your wanting or trying to resolve (I didn't read all of the code), but if you mean the problem with the zoneIndex not matching where the player is for:
Lua Code:
  1. GetCurrentMapZoneIndex()
When the users map has a different map loaded AND the user is in a city (or some poi) you can use:
Lua Code:
  1. GetCurrentSubZonePOIIndices()
  2.     Returns: integer:nilable zoneIndex, integer:nilable poiIndex
That is not dependent on the map, but only works in a POI.
 
07/27/15, 07:44 PM   #23
XanDDemoX
AddOn Author - Click to view addons
Join Date: May 2015
Posts: 28
Originally Posted by circonian View Post
Maybe I missunderstand what your wanting or trying to resolve (I didn't read all of the code), but if you mean the problem with the zoneIndex not matching where the player is for:
Lua Code:
  1. GetCurrentMapZoneIndex()
When the users map has a different map loaded AND the user is in a city (or some poi) you can use:
Lua Code:
  1. GetCurrentSubZonePOIIndices()
  2.     Returns: integer:nilable zoneIndex, integer:nilable poiIndex
That is not dependent on the map, but only works in a POI.
The code is a solution for resolving the main zoneIndex even within a city or dungeon map etc without having to manipulate the world map. The player can be stood anywhere (excluding main quest and guild quest maps).

Thought it might be useful for somone

But thanks anyway, at the time, I didn't look to closely at that function as the name didn't sound like what I wanted
 
07/27/15, 11:02 PM   #24
Fyrakin
 
Fyrakin's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 129
Originally Posted by Ayantir View Post
Thank you,

It's
Lua Code:
  1. SetMapToPlayerLocation()
which update the whole thing,

You'll need to after:

Lua Code:
  1. CALLBACK_MANAGER:FireCallbacks("OnWorldMapChanged")

to do not break other addons (and map) aswell.

and then the functions works well.
Well, I wouldn't recommend doing this too often if you have many custom pins, the callback will force all add-ons to refresh pins on the map and if you also use minimap - there as well.
The wrong zone ids are for some quest areas, the best way to determine where you are so far is by getting current map texture. Of cource its not as reliable as if there would be an API function to tell us which mapId is our player at.
 
07/28/15, 01:02 AM   #25
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by Fyrakin View Post
Well, I wouldn't recommend doing this too often if you have many custom pins, the callback will force all add-ons to refresh pins on the map and if you also use minimap - there as well.
This is why one should check the return value to know if the notification callback is necessary at all.
And, depending on where and when you want to do this, one should check if the user is currently browsing the world map with:
ZO_WorldMap_IsWorldMapShowing()
 

ESOUI » Developer Discussions » Wish List » [outdated] WorldMap - mapIDs, detection when map is changed


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off