Maintenance for the week of December 23:
• NA megaservers for maintenance – December 23, 4:00AM EST (9:00 UTC) - 9:00AM EST (14:00 UTC)
• EU megaservers for maintenance – December 23, 9:00 UTC (4:00AM EST) - 14:00 UTC (9:00AM EST)

Rotate texture to point towards GetMapPlayerWaypoint and GetMapRallyPoint

DTStormfox
DTStormfox
✭✭✭✭✭
I am currently using an addon that uses a texture to track North. It sets a small texture near the reticule (centre of the player screen) that rotates based on your camera heading.

I was wondering if a similar approach can be used to rotate a texture based on the location of a custom destination. In essence, I want to edit an existing add-on and add some more texture layers to rotate based on the player custom destination (GetMapPlayerWaypoint) and rally point (GetMapRallyPoint)

Or does that require complex programming? And if so, does anyone know some good tutorials or materials to learn LUA?
Only responds to constructive replies/mentions

Immortal-Legends Guild Master
Veteran PvP player


  • M0R_Gaming
    M0R_Gaming
    ✭✭✭
    What you are describing isn't all that hard usually. Its simply taking 2-3 API calls, one to check your direction and location, one to check the marker location, then its just some backend math to calculate how far to rotate the reticle.

    I'd recommend taking a look at wiki.esoui.com as this is the 'main' page for addon devs, and answers a ton of questions that you may have about addon making.

    How I would go about doing this (in a spoiler for if you want to come up with the logic by yourself):
    Setup a map ping event: EVENT_MAP_PING
    Callback should check if pingType == MAP_PIN_TYPE_RALLY_POINT or MAP_PIN_TYPE_PLAYER_WAYPOINT
    If pingEventType == PING_EVENT_ADDED, we can then ask it to call a function every 100ms or something with EVENT_MANAGER:RegisterForUpdate, and if pingEventType == PING_EVENT_REMOVED then we unregister it.

    The update function would then GetMapRallyPoint() and/or GetMapPlayerWaypoint() and GetMapPlayerPosition(string unitTag) [Or run GetPlayerCameraHeading() as well to base it off the camera].
    Then get the arctan from the differences in X and Y, then finally some addition and/or subtraction to get the position relative to the player.

    Now that I think about it, the first whole segment could probably be removed, and just in initialization you can have it run every 100ms then just check to see if there is a rally or waypoint in the update function.

    The biggest things that I found hard to adapt to when switching to lua is that lua indexes starts at 1 instead of 0. That and basically everything is an a table (luas equivalent version of like a javascript object or something).
    Some more ESO specific stuff, in ESO, you cant use print(), you have to instead use d(), that will display to your chat log. You can also run code snippets ingame by running /script [lua code] in your chat box.
    In regards to rotating something on screen, take a look at https://wiki.esoui.com/Controls#TextureControl or some of the stuff on wiki.esoui.com for more details. Finally, the dev community also has a glitter page, which is linked on wiki.esoui.com, where a lot of people will be able to help you out much faster than via forums.
    Edited by M0R_Gaming on July 22, 2021 3:31PM
    • PC/NA - PvP/PvE AD Magsorc main
    • Former Emp, All HMs but DSR
    My addons
Sign In or Register to comment.