The fx are spamming because everything's onRecomputeStat hook is called every frame (60fps)Lorial wrote: ↑Sat Aug 31, 2019 12:42 pm If I equip the last item of a custom armor set, it seems to spam the message/sound every frame.
Is there a way to get the message/sound only once? Would adding/removing a trait for that be the better choice?
Code: Select all
{ class = "EquipmentItem", protection = 2, evasion = 3, onRecomputeStats = function(self, champion) if champion:isArmorSetEquipped("tattered") then -- hudPrint(champion:getName().." is now wearing the full Tattered Set.") champion:addStatModifier("protection", 2) champion:addStatModifier("evasion", 4) end end,
At a glance, Id say run your code from onEquipItem and onUnequipItem hooks
Those hooks are called whenever you un/equip, not every frame
Thanks for the reminder!!One thing I noticed, though, the spelling must be that of the trait id, not the name displayed in the traits window (Meditation - meditation). Gets a bit ugly when it hudPrints "X loses the improved_dual_wield trait". When changing to a capital "M", it doesn't work anymore, the trait won't get removed.
