Thread Tools Display Modes
Prev Previous Post   Next Post Next
06/04/14, 12:37 PM   #1
Dehr'Metzgar
Join Date: Jun 2014
Posts: 2
How to stop multiple triggers?

Hello i am very new to modding and using .lua code so what i do is take existing addons and change them little to my liking...
Now i am looking for a way to prevent the "execute" notification when target is below 25% from beeing triggered every time i strike target.
Can somebody please help me in how to do this?
i tried kind of in line 28 (notepad++)
The addon i use at the moment is CombatCloud by Sideshow which is pretty awesome by itself only things
i changed was font and labeling on powerbars.
And i implented said "execue" notification without getting how to prevent notification from popping up when its shown on screen allready.
Danke für die Hilfe im Vorraus


here the Power.lua.
Red color is the function i changed for "execute"notification to show on screen:


CombatCloud_PowerEventListener = CombatCloud_EventListener:Subclass()

function CombatCloud_PowerEventListener:New()
local obj = CombatCloud_EventListener:New()
obj:RegisterForEvent(EVENT_POWER_UPDATE, function(...) self:OnEventt(...) end)
self.powerInfo = {
[POWERTYPE_HEALTH] = { wasWarned = false, notificationType = CombatCloudConstants.notificationType.LOW_HEALTH },
[POWERTYPE_STAMINA] = { wasWarned = false, notificationType = CombatCloudConstants.notificationType.LOW_STAMINA },
[POWERTYPE_MAGICKA] = { wasWarned = false, notificationType = CombatCloudConstants.notificationType.LOW_MAGICKA }
}
return obj
end


function CombatCloud_PowerEventListener:OnEventt(unit, powerPoolIndex, powerType, power, powerMax)
if (unit == 'reticleover' and self.powerInfo[powerType] ~= nil) then
local t = CombatCloudSettings.toggles
local threshold = CombatCloudSettings.threshold or 35

if (power <= 0
or powerType == POWERTYPE_HEALTH and not t.showLowHealth
or powerType == POWERTYPE_STAMINA and not t.showLowStamina
or powerType == POWERTYPE_MAGICKA and not t.showLowMagicka) then
return
end
local percent = power / powerMax * 100
local ms = GetGameTimeMilliseconds()
if self.powerInfo[powerType].wasWarned then return end
-- Check if we need to show the warning, else clear the warning
if (percent < threshold and not self.powerInfo[powerType].wasWarned) then
self:TriggerEvent(CombatCloudConstants.eventType.NOTIFICATION, self.powerInfo[powerType].notificationType.EXECUTE, power)
self.powerInfo[powerType].wasWarned = true
end
end

if (unit == 'player' and self.powerInfo[powerType] ~= nil) then
local t = CombatCloudSettings.toggles
local threshold = CombatCloudSettings.threshold or 35

if (power <= 0
or powerType == POWERTYPE_HEALTH and not t.showLowHealth
or powerType == POWERTYPE_STAMINA and not t.showLowStamina
or powerType == POWERTYPE_MAGICKA and not t.showLowMagicka) then
return
end
local percent = power / powerMax * 100

-- Check if we need to show the warning, else clear the warning
if (percent < threshold and not self.powerInfo[powerType].wasWarned) then
self:TriggerEvent(CombatCloudConstants.eventType.NOTIFICATION, self.powerInfo[powerType].notificationType, power)
self.powerInfo[powerType].wasWarned = true
elseif (percent > threshold + 10) then -- Add 10 to create some sort of buffer, else the warning can fire more than once depending on the power regen of the player
self.powerInfo[powerType].wasWarned = false
end
end
end
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » How to stop multiple triggers?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off