Hello.
I'm writing my own Roaring Opportunist tracker that checks the presence of RO Cooldown ability on the group members dynamically.
However, this is not a "buff" so it cannot be pulled from
Code:
GetUnitBuffInfo("group" .. i, j)
Thus, I came up with a workaround:
First, in OnUpdate function I go through every group member and fill my GroupDict dictionary like this:
Code:
local groupMemberName = GetRawUnitName("group" .. i)
DynamicRO.GroupDict["group" .. i] = groupMemberName
DynamicRO.GroupDict[groupMemberName] = "group" .. i
So I can get player's name by their unitTag (e.g. "group7") and their unitTag by their name.
Why I am doing this is because I use EVENT_COMBAT_EVENT's targetName. So when I get the event, I fill my event buff tracker dictionary:
Code:
if DynamicRO.GroupDict[targetName] ~= nil then
DynamicRO.EventBuffTracker[DynamicRO.GroupDict[targetName]] = {}
DynamicRO.EventBuffTracker[DynamicRO.GroupDict[targetName]][abilityId] = {}
DynamicRO.EventBuffTracker[DynamicRO.GroupDict[targetName]][abilityId].EndsAt = GetGameTimeMilliseconds() + 22000
end
I'm using a whole new {} for each ability because I may want to expand it to support other abilities not tracked by GetUnitBuffInfo and other logical components in the future.
Finally, back in the group loop, if I see that the unitTag's corresponding EventBuffTracker RO buff is nil or less than the current time, I can conclude that RO needs to be recast.
...
Now, is there a better way for this? I kinda don't like this workaround with using 2 external dictionaries. I also found it to be unstable at times and thus I had to add
Code:
DynamicRO.GroupDict[targetName] ~= nil
although I've no idea when it can be nil.
I hope I was clear enough with my explanation and would appreciate some help.
Cheers!