View Single Post
02/08/23, 10:14 AM   #1
Anumaril
 
Anumaril's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2018
Posts: 14
Does OnPowerUpdate have an equivalent of 'OldValue'?

As part of the addon I'm making, I want to detect when the player's health decreases if it's decreased by 15% or more. If it does, then I want to have a red overlay flash on the screen to let them know they were hit hard by an attack.

I have the following, but am lacking the critical piece because from all my searching I can't find an equivalent of 'oldValue' for the OnPowerUpdate function. Without a way to detect what the power value was before being hit, I don't see a way of getting this to work:

Code:
if oldValue > powerValue then
	healthLost = oldValue - powerValue
	healthLostPercent = healthLost / powerMax

	if healthLostPercent >= 0.15 then
		BloodUIHitCritical:SetAlpha(1.0)
	end
end
(I saw 'powerEffectiveMax' was connected to OnPowerUpdate, but have yet to find a description *anywhere* as to what it refers to)
  Reply With Quote