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 |
GetUnitPower("player", power_type_health)
power_type must be of constants CombatMechanicFlags h5. CombatMechanicFlags * COMBAT_MECHANIC_FLAGS_DAEDRIC * COMBAT_MECHANIC_FLAGS_HEALTH * COMBAT_MECHANIC_FLAGS_MAGICKA * COMBAT_MECHANIC_FLAGS_MOUNT_STAMINA * COMBAT_MECHANIC_FLAGS_STAMINA * COMBAT_MECHANIC_FLAGS_ULTIMATE * COMBAT_MECHANIC_FLAGS_WEREWOLF Just save it in a local variable which was defined outside of your callbackFunction for the event, each time the event fires. Code:
local oldValues = {} |
Thanks Beartram! Works like a charm :)
|
All times are GMT -6. The time now is 05:20 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI