don't know how to detect zone change
Hello,
I'm new to lua, and I was trying to create an addon, nothing to much complicated. i wanted to detect EVENT_ZONE_CHANGED, but can't detect anything. EVENT_MANAGER:RegisterForEvent(NiceT.name, EVENT_EVENT_ZONE_CHANGED , NiceT.OnPlayerZoneChanged) EVENT_MANAGER:RegisterForEvent(NiceT.name, EVENT_EVENT_ZONE_CHANGED , NiceT.OnPlayerZoneU) I'm Using this two event manager, and can't see nothing in debug window(just made a little function that when it's called does just d("Hello1") or d("hello2") |
Quote:
|
hey,
ty for the reply, but that was just an error copying here, in the addon is without "double" event_ |
Quote:
|
Quote:
} NiceT.name = "NiceT" function NiceT.Initialize() d("Thanks for using NiceT!") NiceT.ZN = GetUnitZone("player") --just trying d(NiceT.ZN) EVENT_MANAGER:RegisterForEvent(NiceT.name, EVENT_ZONE_CHANGED, NiceT.OnPlayerZoneChanged) EVENT_MANAGER:RegisterForEvent(NiceT.name, EVENT_ZONE_UPDATE , NiceT.OnPlayerZoneU) end function NiceT.OnAddOnLoaded(event, addonName) if addonName == NiceT.name then NiceT.Initialize() end end function NiceT.OnPlayerZoneChanged( eventCode, zoneName, subZoneName, newSubzone, zoneId, subZoneId) d("HELLO2") end function NiceT.OnPlayerZoneU( eventCode, unitTag, newZoneName) d("HELLO1") end EVENT_MANAGER:RegisterForEvent(NiceT.name, EVENT_ADD_ON_LOADED, NiceT.OnAddOnLoaded) |
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:
|
Quote:
TY :), this helped me a lot |
ZOS has features that show in the UI such as when you are close to the Wayshrine it mentions which Wayshrine. Maybe you enter a city and it says the name of the city. However, when you exit a city it may trigger something for the UI but the zone's information is still for the city.
There are many places where you will not get accurate information because the developers made it do what they want. Because of that it doesn't really return what I might want for a mod like Lorebooks or for whatever you are doing. So what's this for? Will you be adding map pins using LibMapPins? Depending on what you need I may have some other options. |
Quote:
thanks baertram |
Quote:
|
All times are GMT -6. The time now is 02:04 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI