ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Is there a way to get the player's unitId? (https://www.esoui.com/forums/showthread.php?t=7383)

Letho 09/27/17 02:01 PM

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

Scootworks 09/27/17 02:43 PM

why not simply check again GetUnitBuffInfo("player", ...) with event EVENT_PLAYER_ACTIVE? that works after reloadUI

Letho 09/27/17 03:05 PM

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.

dorrino 09/29/17 12:52 AM

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.

Letho 09/29/17 04:53 AM

I was afraid of this. Here comes the dirty way of raping svars....

sirinsidiator 09/29/17 05:00 AM

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? :confused:

Letho 09/29/17 05:12 AM

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.

sirinsidiator 09/29/17 05:42 AM

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...

Scootworks 09/29/17 06:31 AM

Quote:

Originally Posted by Letho (Post 32773)
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

Baertram 09/29/17 06:47 AM

Quote:

this has been tested with and without addons on their and my side with no difference
I tink they did :D

Scootworks 09/29/17 07:02 AM

Quote:

Originally Posted by Baertram (Post 32776)
I tink they did :D



i should read it better :-)

but i know that problem exist almost 7-8 months ago.. after that it worked fine.. hmm

Letho 09/29/17 07:05 AM

Quote:

Originally Posted by sirinsidiator (Post 32774)
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.

Quote:

Originally Posted by Scootworks (Post 32775)
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^^

Phinix 11/25/17 02:32 AM

Quote:

Originally Posted by dorrino (Post 32770)
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()!

:D

Solinur 11/25/17 02:30 PM

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 ?

Letho 11/25/17 03:53 PM

Quote:

Originally Posted by Phinix (Post 33235)
[...]

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

:D

@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?

Quote:

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"^^

Quote:

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.

Phinix 11/25/17 05:13 PM

Quote:

Originally Posted by Letho (Post 33244)
@ZOS_ChipHilseberg: Please add a function GetUnitId(unitTag) to the game.

YES... Seconded! That sounds perfect. :D

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.

Quote:

Originally Posted by Letho (Post 33244)
...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.

Letho 11/26/17 12:52 AM

Quote:

Originally Posted by Phinix (Post 33251)
[...]

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 :D


All times are GMT -6. The time now is 06:54 AM.

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