Quantcast Distance in units to an enemy NPS? - ESOUI
Thread Tools Display Modes
07/13/19, 03:12 AM   #1
Join Date: Nov 2014
Posts: 3
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

  Reply With Quote
07/13/19, 04:54 AM   #2
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,645
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.

Please correct me if I'm wrong and we are able to meanwhile. Thanks
  Reply With Quote
07/14/19, 02:09 AM   #3
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 235
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!

Last edited by Letho : 07/14/19 at 02:11 AM.
  Reply With Quote
07/14/19, 11:02 AM   #4
Drakanwulf's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2017
Posts: 50
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...
Drakanwulf, the dire wolf that hunts dragons!
  Reply With Quote
07/14/19, 02:11 PM   #5
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 235
That was the way to do it. ZOS disabled getting loc coords for targets though
  Reply With Quote
08/02/19, 06:22 AM   #6
Join Date: Nov 2014
Posts: 3
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.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Distance in units to an enemy NPS?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off