ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Distance in units to an enemy NPS? (https://www.esoui.com/forums/showthread.php?t=8637)

shAndrew 07/13/19 03:12 AM

Distance in units to an enemy NPS?
 
HI all.
I what to implement a simple helper add-on for myself that will do the following:
if player in combat - it finds all enemies and places a marker on them (will try to place the same method as it is implemented in Harvest Map) with a specified color. Color will be changed depending on abilities I have on my bar. For example I have 3 dmg abilities on my bar. all 3 with different range (20, 8, 3). Set marker or pin with color red on enemy if he's in range of ability1 with range 20. Update pin if enemy in range of ability2 and ability3.
In order to achieve that I need the following:
1. Ability range value. - I believe GetAbilityRange(abilityId) gives me what I need.
2. At least enemies position list. From that data I can figure out the distance using simple vector2 distance calculation formula.
3. Place a pin on it.
So my questions are:
1. Is it even possible to get Enemy position? If not - how this can be achieved in other ways?
2. I think I'll manage to figure out how Harvest Map addon places its pins, but would be appreciated if anyone explain how to place such pins :)

Thanks.

Baertram 07/13/19 04:54 AM

Afaik you cannot do this as the unitTag of the enemies in combat might be different but their names won't be always different. You don't know which enemy is which.
And in the past we were not able to get the coordinates (x,y,z) for another unittag except if they are grouped with us (addons like Provisions Team Formation of Papa Crown or Votans Group Pins used it I think. Maybe this changed but if not I don't see any chance to achieve your goal.

I always wanted to have custom markers on the enemies or group members buit the API is not able to succeed completely as it seems.

@others:
Please correct me if I'm wrong and we are able to meanwhile. Thanks

Letho 07/14/19 02:09 AM

Puting markers above enemies should be impossible as modifying parts of the rendered game world with lua is not implemented in ESO. Concerning the range thing: That is also not possible, i have tried it myself... the best approach was using map coordinates but ZOS blocked the required functionality a while ago.

I would definetely second a request for GetRangeToUnit(unitTag or unitId) though!

Drakanwulf 07/14/19 11:02 AM

This might be possible IF you could get location coordinates in meters. If that were ever possible, then all you need to know are the X,Y measurements of A and B to use a variation of the Pythagorean Theorem to calculate C which would be the distance (in meters) between A and B. Well, I think it's the Pythagorean Theorem, anyway... :)

Letho 07/14/19 02:11 PM

That was the way to do it. ZOS disabled getting loc coords for targets though :(

shAndrew 08/02/19 06:22 AM

Thanks everyone for quick answer. Was not able to answer earlier...
I've tried to get distance info using some workarounds... using combat event with some filters, reticleover target. Can get the unit tag that attacked the player form one of the combat event return values, but further usage of that unit tag unfortunately returns zero values. Will be looking into that later. If will find a solution - will post here.
Thanks everyone.


All times are GMT -6. The time now is 03:49 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI