I want to improve DebuffVitals by reducing brute force searching down to a direct Contains() call. I strongly suspect this will improve performance issues, as well as being a more elegant solution.
However, I haven't yet figured out how to use the EffectList:Contains() method correctly, and I hope someone with more insight could share what they know?
I expect to pass a Turbine.Gameplay.Effect object, but I can't seem to create a Turbine.Gameplay.Effect object directly. Is there an enumeration of Effects that I can reference? Some list of asset tags that I could extract and then use (like various resource browsers have done)? Some constructor definition that uses specific unique IDs?
Can the method even be used this way, or am I barking up the wrong tree?
Thanks a lot,
Interesting idea. I didn't notice that function, back when I was trying to get target effects to work.
I don't think you can create the objects directly; nor is there any enumeration of all possible effects. I think the best you can do is save all of the effects into a hash as you receive them from EffectAdded events or EffectList:Get(). Of course, if you are maintaining that hash, there's no reason to call the Contains() function. Just do a direct hash table lookup.
In case it's not clear, I mean maintaining a list of the form
I still have my fingers crossed that the situation will be improved in U24.
Hmm, I'm not sure about what you've described. It doesn't fit into the usage patterns and code flow, or I don't understand what you meant, or both, or something else.
I have a different idea, which is to persist the first one of a specific effect, and then use it for all subsequent checks. I don't know if an Effect from one EffectList can be used to check against a different EffectList though. Need to do some more testing.
Fall-back plan though. I have hopes that a dev may respond on Lotro forums.
Well, I'm not quite sure how you want to use EffectList:Contains(), but my point is that
if (effectList:Contains(effect)) thenis probably not significantly more efficient than
if (effectIsPresent[effect]) thenwhere effectIsPresent is a hash table that you have built with
effectList.EffectAdded = function(obj, args)of course assuming that the "EffectRemoved" event is fixed in U24.local effect = obj:Get(args.Index);end
Note: I believe each instance of an effect has its own distinct object. So you can't create an Effect object for a given effect and use that for comparison to future instances of that effect.
Taking it up a level, I want to reduce impact of the plugin on game performance. I've had feedback about lag from users. I'm pretty sure it's coming from the repeated Effect* callbacks feeding into nested for loops.
I hoped that I could use EffectList:Contains() to cut down on the loop. Instead, I'm going to do some adjustable throttling instead, to cut down on callback triggers. Maybe some additional handling cases where there are multiple DV windows targeted on one thing.
|All times are GMT -5. The time now is 09:07 PM.|
vBulletin® - Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.