Originally Posted by
Bossqwerty
@Valma
I tried the swing timer code you made me and I didn't have any luck, it's more likely me not understanding enough about coding to use it than your code. I don't need to track swingtimer on screen or anything, I just want some variable in the background so I can make something like this "if TimeUntilHit < .5 then"
If anyone at all knows how I could accomplish this I'd really appreciate it, this is the one thing I can't figure out
Code:
if not PQ_EventHandlerLoaded then
local PQ_EventHandlerFrame, events = CreateFrame(&quot;Frame&quot;), {};
function events:COMBAT_LOG_EVENT_UNFILTERED(...)
if (select(3, ...) == "SWING_DAMAGE" or select(3, ...) == "SWING_MISSED") and (bit.band(select(5, ...), COMBATLOG_OBJECT_AFFILIATION_MASK) == COMBATLOG_OBJECT_AFFILIATION_MINE) then
swingTime = UnitAttackSpeed("player")
swingEnd = GetTime() + swingTime
end
PQ_EventHandlerFrame:SetScript(&quot;OnEvent&quot;, function(self, event, ...) events[event](self, ...); end);
for k, v in pairs(events) do
PQ_EventHandlerFrame:RegisterEvent(k); -- Register all events for which handlers have been defined
end
PQ_EventHandlerLoaded = true
end
This is the handler you need.Furthermore for what you are trying to do you just need to add check anywhere you want if (swingEnd - GetTime()) &lt; 0.5 then blablabla