Non-localized ID for sub-zones?

Hello!

I’m working on an addon that triggers specific actions when the player enters a new zone. For example, I want to change the music when entering a new zone.

So far, I’ve had no issues using frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") to detect when the player moves from one map to another. It works perfectly when transitioning between areas like Isle of Dorn and Dornogal. I use C_Map.GetBestMapForUnit("player") to get the map IDs and compare them to detect where the player is, which allows me to trigger events without problems.

However, this method only works when moving between different maps. The challenge arises when the player moves between zones within the same map, like from The Orecreg to Wanderer’s Landing (both in Isle of Dorn). There doesn’t seem to be a reliable way to detect these zone changes with an ID, as the GetSubZoneText() function only returns the zone name, which is localized and would complicate localization for the addon.

Is there a way to detect zone changes using a unique, non-localized ID?

Thanks!

https://warcraft.wiki.gg/wiki/ZONE_CHANGED

And maybe throw in PLAYER_ENTERING_WORLD for good measure.

1 Like

Yes, haha, it definitely works great for detecting when the player changes zones!

I appreciate you taking the time to answer. My question was more about whether there’s a way to retrieve any kind of ID linked to the current sub-zone the player is in, like a zoneID or areaID for places like The Orecreg or Wanderer’s Landing.

Detecting when a player changes zones is straightforward, but I haven’t found a way to get the current sub-zone’s ID (besides using GetSubZoneText()), which complicates things for localization.

I don’t believe there is a “sub-zone” ID available to the API, just the names.

About the only way you could break it down would be with

C_PvP.GetZonePVPInfo

to get the zone pvp type (sanctuary, contested, hostile, friendly etc.) and that probably doesn’t go down to the level you want.

If it doesn’t exist, then I won’t bang my head against a brick wall trying to implement it. It would definitely be cool to have those IDs added to the API sometime in the future, though!

Thanks a lot for your help!

You might be able to compare the name returned with a global string which I presume the game uses for localising them.