|
06/04/14, 12:37 PM | #1 | |
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 |
|
06/04/14, 02:30 PM | #2 |
|
Sorry, I already don't get why the original code works.
|
06/04/14, 02:38 PM | #3 |
There is needed a bit more code to make it work. I think the best way is to ask Sideshow to add it...
If you want do all the job, you will need to add your new notification type to the Power.lua, Constants.lua, Notification.lua, Menu.lua, Defaults.lua and to the localization files. If you just want to make it somehow work with no settings, you will need to make at least the following changes: changed parts of Core\EventViewers\Notification.lua: Lua Code:
changed part of Core\EventListeners\Power.lua: Lua Code:
|
|
06/04/14, 06:08 PM | #4 | |
Join Date: Jun 2014
Posts: 2
|
thank you for fast answers!
i did changes to other .lua files but didnt post the code in forum. what im trying to say here is that i actually managed to make an "execute!" appear on screen whenever i hit an target which is < 25 percent health. so that works fine but it will show up ALLWAYS when i strike the target again. this way i sometimes get about 4-5 "execute!" notifications on screen at the same time. i need some code that stops "execute!" -notification when there is already an "execute!" -notification on srceen. maybe you can help me with this. sry for my writing... kind of not to the point since i am no native speaker.... |
|
ESOUI » Developer Discussions » Lua/XML Help » How to stop multiple triggers? |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|