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 |
why not simply check again GetUnitBuffInfo("player", ...) with event EVENT_PLAYER_ACTIVE? that works after reloadUI
|
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.
|
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. |
I was afraid of this. Here comes the dirty way of raping svars....
|
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: |
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.
|
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...
|
Quote:
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 |
Quote:
|
Quote:
i should read it better :-) but i know that problem exist almost 7-8 months ago.. after that it worked fine.. hmm |
Quote:
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:
|
Quote:
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 |
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 ? |
Quote:
Quote:
Quote:
|
Quote:
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:
|
Quote:
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 04:10 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI