Originally Posted by Garkin
GetCurrentMapZoneIndex()
For example Cyrodiil zone index is 37. But if you open map of any of the border keeps, it will return the same zone index. So this is not usable function to identify map.
GetCurrentMapIndex()
I believe this has something to do with locations list on world map. If you try to use this function on any other map that is not listed there, it will return nil.
|
Actually, GetCurrentMapIndex returns a number that reflects the id of the Map as the following test code I have been running and its result. The GetCurrentMapZoneIndex function seems to always return 9 which coincidently is the number of locations listed in each zone so this might be what you meant.:
Lua Code:
local mapCount = GetNumMaps()
for i = 1,mapCount do
local mapZoneName, mapZoneMapType, mapZoneMapContentType = GetMapInfo(i)
local numLocations = GetNumMapLocations(i)
ChatMsg:AddMessage(string.format("ID: %d - Name: %s - Locations: %d",i,mapZoneName,numLocations))
end
local mapIndex,mapZoneIndex,mapName
mapIndex = GetCurrentMapIndex()
mapZoneIndex = GetCurrentMapZoneIndex()
mapName = GetMapName()
ChatMsg:AddMessage(string.format("Before: MapIndex: %s - MapZoneIndex: %s - MapName: %s",tostring(mapIndex),tostring(mapZoneIndex),tostring(mapName)))
SetMapToPlayerLocation()
mapIndex = GetCurrentMapIndex()
mapZoneIndex = GetCurrentMapZoneIndex()
mapName = GetMapName()
ChatMsg:AddMessage(string.format("After: MapIndex: %s - MapZoneIndex: %s - MapName: %s",tostring(mapIndex),tostring(mapZoneIndex),tostring(mapName)))
Results:
1 - Tamriel - 9
2 - Glenumbra - 9
3 - Rivenspire - 9
4 - Stormhaven - 9
5 - Alik'r Desert - 9
6 - Bangkorai - 9
7 - Grahtwood - 9
8 - Malabal Tor - 9
9 - Shadowfen - 9
10 - Deshaan - 9
11 - Stonefalls - 9
12 - The Rift - 9
13 - Eastmarch - 9
14 - Cyrodiil - 9
15 - Auridon - 9
16 - Greenshade - 9
17 - Reaper's March - 9
18 - Bal Foyen - 9
19 - Stros M'Kai - 9
20 - Betnikh - 9
21 - Khenarthi's Roost - 9
22 - Bleakrock Isle - 9
23 - Coldharbour - 9
24 - Oblivion - 9
When first logging in:
Before: MapIndex: nil - ZoneIndex: 9 - Davon's Watch
After: MapIndex: nil - ZoneIndex: 9 - Davon's Watch
Port to Hrogar's Hold:
ZoneChanged:
Before MapIndex:nil - ZoneIndex: 9 - Davon's Watch
After MapIndex: 11 - ZoneIndex: 9 - Stonefalls
ZoneChanged:
Before: MapIndex: 11 - ZoneIndex: 9 - Stonefalls
After: MapIndex: 11 - ZoneIndex: 9 - Stonefalls
As you can see MapIndex is getting the right information when not in a town. It could possibly be the same if you 'need the subzone' within the zone for any zone.
And now with another character:
Same ID and Names in the list but 14 instead of 9 Locations per zone
And the Before/After display is as follows:
Before: MapIndex: nil - ZoneIndex:178 - Vulkhel Guard
After: MapIndex: nil - ZoneIndex:178 - Vulkhel Guard
Port to Mathiiesin Wayshrine
Before: MapIndex:15 - ZoneIndex:178 - Auridon
After: MapIndex:nil - ZoneIndex:178 - Vulkhel Guard
Notice the 178 ZoneIndex ... I have no idea what this value is as I haven't found a function that returns anything that makes sense.