01/07/16, 10:14 AM | #1 |
|
EVENT_EFFECT_CHANGED and unitIDs
Hey,
I have 2 questions:
Edit: Ok, they definately change, just don't know on what condition(s) yet. Last edited by coolmodi : 01/07/16 at 01:17 PM. |
01/07/16, 06:04 PM | #2 | ||
|
Quote from: http://www.esoui.com/forums/showthread.php?p=21696#post21696
|
||
01/08/16, 10:09 AM | #3 |
|
Thanks! So they just change when going out of visual range I guess, and probably when zoning.
I'll just migrate the data from one unit ID to the other when it changes then, and delete the old entry. That way it should be possible to track players even in cyrodiil reliably. |
01/08/16, 06:50 PM | #4 | ||
|
Despite the wording of this post:
Since other targets/mobs do not have unique names you can not use the units name as a key for the data (not even for players because we can't distinguish between players & mobs to separate the two). It also means that if the unitId changes you can't migrate the data because you have no way of knowing what the original unitId was to find the correct data to migrate. Also migrating the data would probably be a bad idea. As an example: If a player went out of range & his unitId changed (or even if it didn't change) he was probably far enough out of range that when his effects changed the event did not fire for us so that effect data you have saved is probably no longer valid. This also means that if you want to track effects on mobs you have no choice but to also track effects on players (and vice-versa) since we can't tell them apart. My best thought would be to save everything by UnitId and if a targets unitId changes just let it change and start saving new data for that target. Also record a timestamp in the saved effects data table each time the data is updated for any given unitId. Then set a RegisterForUpdate(...) and every once in a while check the timestamps for all of your saved effect data & if its xxx old (meaning it hasn't been updated in a while) assume its no longer valid and delete the data to keep the table clean. Although its not a good solution its the best I've come up with. I added some things that might help a little to the wish list a while back. Maybe someday we'll get some functions to help with things like this: http://www.esoui.com/forums/showthread.php?t=5298 |
||
01/08/16, 08:11 PM | #5 | ||
|
Basic arrays needed, just to show the data structure Lua Code:
Then some changed wip code from my addon: Lua Code:
This should work, I even tested it ingame, but with a much worse solution in terms of performance, hence the extra array with [name] = ID pairs, so I can just use ~= two times and don't have to loop through the unitList Thanks to effect changed ALWAYS giving name and ID this should work pretty reliable too, as soon as someone comes in range it will fire even if they only have the ESO PLUS buff, or a food buff, really anything. In that moment I will have their new id, and the old one from the name+id pairs.
But anyways, why would the effect data not be valid anymore? Doesn't it just provide begin and end time of buffs? That won't change only because they were out of range, so what isn't valid anymore? Edit: And why are the code containers not as wide as quote containers here?? Last edited by coolmodi : 01/08/16 at 09:00 PM. |
||
01/08/16, 08:59 PM | #6 | |
|
Just fyi so you don't end up with a bug: Lua Code:
Last edited by circonian : 01/08/16 at 09:04 PM. |
|
01/08/16, 11:52 PM | #7 |
|
All those generic mobs like "Skeleton Archer" don't, but special ones, like most bosses, or generally the ones with "unique" names also have their gender appended to the name with ^F or ^M. But in any case it should filter duplicate names I guess, which is the important thing.
Every player should have ^Fx or ^Mx, out of hundreds not a single one didn't have an x, no clue what that x is for though. The few world bosses I checked didn't have it, only ^F or ^M, but can't say if that is a general pattern or not. The boss in the screen on my addon's page also has only ^M though. This needs some investigation All according to plan...no seriously, thx, just way to tired, even took me a time to see whats wrong now that you mentioned it |
01/09/16, 07:10 AM | #8 | |
The question is, why do you even need the function you posted? You can easily get that information without keeping a list. Lua Code:
Last edited by sirinsidiator : 01/09/16 at 07:13 AM. |
||
01/09/16, 11:27 AM | #9 | ||
|
Lua Code:
It would ofc be possible to get rid of unitList, but then I'd need to handle everything in currentFightData and keep every unit info in for every new fight, effectively having useless info in the combatHistory, and it's also easier to handle changing IDs that way, as it only needs to be updated in unitList and every new fight will just use correct info. Those are the event handlers if that helps to understand my thought process: Lua Code:
Edit: Also, is there any difference between using match and find to see if a string contains something? Both are not nil in that case, but find returns start and end while match returns the word(s), right? Last edited by coolmodi : 01/09/16 at 11:57 AM. |
||
01/09/16, 02:04 PM | #10 |
That makes more sense.
Btw instead of checking if the combat event is an error and which actionResult it has inside lua, you should use AddFilterForEvent and let the game handle filtering. You may need to split the handling over multiple functions, but it's much faster that way. See this wiki page for what I mean. |
|
01/10/16, 08:34 AM | #11 | |
|
Filters were a thing I wanted to do for a long time, never figuered out how to add multiple results though, but that part got updated as it seems, or I was blind...
|
|
01/10/16, 09:29 AM | #12 |
It was there all along. You can also just call AddFilterForEvent multiple times for the same event and it will also work. Just updated the wiki to reflect this.
|
|
01/10/16, 10:28 AM | #13 | |
|
Edit: If anyone ever finds this with the same question, then here's my current solution to multiple results with multiple handlers: Lua Code:
I could reduce the need for IFs in LUA to checking whether I need to create arrays or not, which should be a major improvement I guess. Last edited by coolmodi : 01/11/16 at 07:24 PM. |
|
ESOUI » Developer Discussions » General Authoring Discussion » EVENT_EFFECT_CHANGED and unitIDs |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|