View Single Post
04-24-14, 11:16 PM   #9
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Why do you need to force the map back to the current zone every time it gets changed?

If you need information about the map the player is currently on, you only need to call SetMapToCurrentZone in response to a few zone events, store whatever information you need in a table, and after that it doesn't matter what anything does to the map until the next zone event.

Originally Posted by Digital_Utopia View Post
Unfortunately, the ZCNA event fires on any change to the map whatsoever - actual zone changes, which was the (presumed) intent, player map navigation, and API functions that set the map (SetMapToCurrentZone, SetMapByID, and ZoomOut).
ZONE_CHANGED_NEW_AREA doesn't fire when you switch maps, that only triggers WORLD_MAP_UPDATE.

Here's a small example to demonstrate when each event actually fires..
Lua Code:
  1. local f = CreateFrame('frame')
  2. f:SetScript('OnEvent', function(self, event, ...)
  3.     print(event, GetRealZoneText(), GetSubZoneText())
  4. end)
  5. f:RegisterEvent('ZONE_CHANGED_NEW_AREA')
  6. f:RegisterEvent('ZONE_CHANGED_INDOORS')
  7. f:RegisterEvent('ZONE_CHANGED')
  8. f:RegisterEvent('NEW_WMO_CHUNK')

Last edited by semlar : 04-24-14 at 11:45 PM.
  Reply With Quote