View Single Post
03/17/23, 11:37 AM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,000
Event_zone_changed does not fire for all changed zones afaik, only if you are e.g. inside a city and step out to the worldmap again etc.

Try EVENT_PLAYER_ACTIVATED instead (fires after login, loading screens where you changed a zone etc.). You can do the zone check there, by using
API functions like

Lua Code:
  1. local zoneIndex = GetCurrentMapZoneIndex()
  2. --Either:
  3. local zoneName = zo_strformat(SI_UNIT_NAME, GetZoneNameByIndex(zoneIndex))
  4. --or if you also need the zoneId:
  5. local zoneId = GetZoneId(zoneIndex)
  6. local zoneName = zo_strformat(SI_UNIT_NAME, GetZoneNameById(zoneId))
  7.  
  8. --Parent zoneId is the id of the parent's zone, e.g. if you are inside a delve in Alik'r Desert the zoneId is the one of the delve and the parentZoneId is the one of the zone (e.g. Alik'r)
  9. loca parentZoneId = GetarentZoneId(zoneId)
etc.
  Reply With Quote