Thread Tools Display Modes
09/27/17, 02:01 PM   #1
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Is there a way to get the player's unitId?

Title says everything, I have searched the forum using the forum search function.

What do I need it for?

I track buffs using EVENT_EFFECT_CHANGED, which communicates the unitId in addition to the unitTag. I use this method to create the holding of active buffs data in the lua environment. Whenever a person uses /reloadui, that data is flushed. So I have to use GetUnitBuffInfo("player", ...) to regain the currently running buffs on the player, because EVENT_EFFECT_CHANGED does not fire the "buff gained" event for currently active buffs. problem is: GetUnitBuffInfo doesn't return unit ids. There would be an option to save the current holding of data to the svars, using timestamps to check if the buffs are still up after using reloadui or relogging, but.... idk, this method feels very abusive.

Does anybody have a clue?

Cheers

Last edited by Letho : 09/27/17 at 02:03 PM.
  Reply With Quote
09/27/17, 02:43 PM   #2
Scootworks
 
Scootworks's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 312
why not simply check again GetUnitBuffInfo("player", ...) with event EVENT_PLAYER_ACTIVE? that works after reloadUI
  Reply With Quote
09/27/17, 03:05 PM   #3
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
GetUnitBuffInfo() is not the problem, it works fine at the time I am calling it. The problem is,contrary to EVENT_EFFECT_CHANGED it does not return the player's unitId, which I need to copy into my holding of data for some specific addon functionality.
  Reply With Quote
09/29/17, 12:52 AM   #4
dorrino
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 50
unitId only exist in some events like EVENT_EFFECT_CHANGED or EVENT_COMBAT_EVENT to distinguish between different units with the same name (at least that's the reason that i know).

None of the game functions returns these unitIds nor takes them as input parameters.
  Reply With Quote
09/29/17, 04:53 AM   #5
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
I was afraid of this. Here comes the dirty way of raping svars....
  Reply With Quote
09/29/17, 05:00 AM   #6
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
Maybe you should explain your usecase in more detail?
The buffs I am thinking about do only last ~15-30 seconds and play a role in combat. Not sure why you are worrying about a UI reload there?
  Reply With Quote
09/29/17, 05:12 AM   #7
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Well, in vMSA I have to reloadui after every 3 stages, as the game's performance drops more and more when continuously playing (according to some friends this also happens in raids and their guild reloadsui after each boss when trying to do no death runs. this has been tested with and without addons on their and my side with no difference, so the game itself must have some sort of memory leak or other fancy coding problems that I don't know or that I rather are not able to comprehend at all....). Whenever I reloadui after a fresh casted surge (33s duration, happens, reflexes and so on...), I lose that display. So yes, the case might be rare, but it happens.
  Reply With Quote
09/29/17, 05:42 AM   #8
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
Ok, then I still do not understand why you can't just use GetUnitBuffInfo like Scoot suggested. The "player" will always just have the unitTag "player". I can't imagine any reason why you would need a unitId in addition to that...
  Reply With Quote
09/29/17, 06:31 AM   #9
Scootworks
 
Scootworks's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 312
Originally Posted by Letho View Post
Well, in vMSA I have to reloadui after every 3 stages, as the game's performance drops more and more when continuously playing (according to some friends this also happens in raids and their guild reloadsui after each boss when trying to do no death runs. this has been tested with and without addons on their and my side with no difference, so the game itself must have some sort of memory leak or other fancy coding problems that I don't know or that I rather are not able to comprehend at all....). Whenever I reloadui after a fresh casted surge (33s duration, happens, reflexes and so on...), I lose that display. So yes, the case might be rare, but it happens.


well, just for a test. did you try that without addons too? i know many people had the same problem. they disabled addons and it worked fine
  Reply With Quote
09/29/17, 06:47 AM   #10
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
this has been tested with and without addons on their and my side with no difference
I tink they did
  Reply With Quote
09/29/17, 07:02 AM   #11
Scootworks
 
Scootworks's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 312
Originally Posted by Baertram View Post
I tink they did


i should read it better :-)

but i know that problem exist almost 7-8 months ago.. after that it worked fine.. hmm
  Reply With Quote
09/29/17, 07:05 AM   #12
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Originally Posted by sirinsidiator View Post
Ok, then I still do not understand why you can't just use GetUnitBuffInfo like Scoot suggested. The "player" will always just have the unitTag "player". I can't imagine any reason why you would need a unitId in addition to that...
Oh I see the problem, i mistyped the title. It was meant to be "a player's unitId", not "THE player's". I need it for a specific feature that I call "peristent target debuff tracking".

If I use reticleover to track target debuffs, this data gets eradicated as soon as I untarget the target though . If "persistent" is checked, the debuff will be tracked regardless of my current reticletarget. That's what I need unitIds for. I can't use the target's name, as the data is structured by unitIds as the array's key.

Originally Posted by Scootworks View Post
well, just for a test. did you try that without addons too? i know many people had the same problem. they disabled addons and it worked fine
As I have already written, I tested it with and without addons in vMSA and so did my friends in a raid, without noticing a difference^^
  Reply With Quote
11/25/17, 02:32 AM   #13
Phinix
 
Phinix's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 186
Originally Posted by dorrino View Post
unitId only exist in some events like EVENT_EFFECT_CHANGED or EVENT_COMBAT_EVENT to distinguish between different units with the same name (at least that's the reason that i know).

None of the game functions returns these unitIds nor takes them as input parameters.
That was my understanding as well. In fact I even tested this for Srendarr extensively many months ago, and all events that returned unitId always returned 0 regardless of the unit or whether it was targeted. Unless something has changed in the API I do not see how it would be possible to use unitId in order to track unit-specific buffs/debuffs with or without a reload.

The method I ended up using relied on name matching and timestamps, but if they changed the API to allow a non-zero value to ever be returned for unitId from combat events, I would happily migrate the code.

Will have to test...

EDIT: OK, so the events that return unitId DO return a unique value now, and those values DO persist through reloads. In theory those SHOULD be usable at least for the purpose of short duration buff and debuff tracking.

HOWEVER, the problem I ran into is that EVENT_RETICLE_TARGET_CHANGED basically doesn't return ANY information (other than eventCode), let along unitId, which sort of makes tracking the buff/debuff information in a table of ability ID's with unitId sub-keys pointless, since you can't actually look up the current target specifically by unitId when your reticle target changes.

If you only care about the player's buffs/debuffs on reload, you could just run a function on init that checks GetUnitBuffInfo('player', i) in a for loop, and for any buff/debuff abilityIDs on the player just reload your buff/debuff indicators with the updated finish time.

You can probably find some examples in Srendarr's AuraControl.lua file.

EDIT EDIT: @ZOS_ChipHilseberg, please add unitID return to EVENT_RETICLE_TARGET_CHANGED and/or GetUnitBuffInfo()!


Last edited by Phinix : 11/25/17 at 12:53 PM.
  Reply With Quote
11/25/17, 02:30 PM   #14
Solinur
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 78
It was asked already a few times. So far we didn't get an answer from chip which probably means, that at this time they don't want it. (Until they have investigated what impact it would have, which they probably have no time for.)

Rergarding unitid's. Usually unitid's are given in EVENT_EFFECT_CHANGED.

For EVENT_COMBAT_EVENT they are usually given for the target, but for the source only if the target is th player.

Also shouldn't unitId's persist trough reloadui ?
  Reply With Quote
11/25/17, 03:53 PM   #15
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Originally Posted by Phinix View Post
[...]

EDIT EDIT: @ZOS_ChipHilseberg, please add unitID return to EVENT_RETICLE_TARGET_CHANGED and/or GetUnitBuffInfo()!

@ZOS_ChipHilseberg: Please add a function GetUnitId(unitTag) to the game. And while we're at it: Please add a totally new field: GlobalUnitId and according functions to it - would that be possible? I mean there must be unique db keys for every entity in the game within the native code, right?

It was asked already a few times. So far we didn't get an answer from chip which probably means, that at this time they don't want it.
That's only speculation on our side, maybe he just hasn't seen it. I won't stop asking until we get a "yes" or "no"^^

Also shouldn't unitId's persist trough reloadui ?
I don't know, but as far as I know they are NOT persistent and get 'destroyed' as soon as the unit gets out of rendering range - and that is a low distance.

Last edited by Letho : 11/25/17 at 03:55 PM.
  Reply With Quote
11/25/17, 05:13 PM   #16
Phinix
 
Phinix's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 186
Originally Posted by Letho View Post
@ZOS_ChipHilseberg: Please add a function GetUnitId(unitTag) to the game.
YES... Seconded! That sounds perfect.

EDIT: Of course I would still like to add them to the events as it would probably be more performant to use them that way where applicable.

Originally Posted by Letho View Post
...as far as I know they are NOT persistent and get 'destroyed' as soon as the unit gets out of rendering range - and that is a low distance.
Yes, but I can confirm through testing they DO persist through /reloadui and so as I said, still useful for tracking SHORT duration buffs/debuffs which is like, 90% of effects in the game.
  Reply With Quote
11/26/17, 12:52 AM   #17
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Originally Posted by Phinix View Post
[...]

Yes, but I can confirm through testing they DO persist through /reloadui and so as I said, still useful for tracking SHORT duration buffs/debuffs which is like, 90% of effects in the game.

Just tested it and can confirm this. On the other hand unitIds would be mainly useful for processing combat events. Those don't give them in every case though, which renders them nearly useless again
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Is there a way to get the player's unitId?

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