Hi,
i have this custom item creaturescript when you wear item you get like 5% more dmg with ENERGYDAMAGE, but it would be better to improve it with more customizable code so i could add more items into this table and adjust %, so for example code looks like this now
And it would be nice to have something like this
So it would be possible to add more items into this table with custom damage precent increase. TFS 1.2
i have this custom item creaturescript when you wear item you get like 5% more dmg with ENERGYDAMAGE, but it would be better to improve it with more customizable code so i could add more items into this table and adjust %, so for example code looks like this now
LUA:
local specialRings = {1526}
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if creature and attacker then
if attacker:isPlayer() then
local ring = attacker:getSlotItem(CONST_SLOT_RING)
if ring and primaryType == COMBAT_ENERGYDAMAGE then
if table.contains(specialRings, ring.itemid) then
local tmpDamage = primaryDamage
primaryDamage = primaryDamage * 1.05
end
end
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
And it would be nice to have something like this
Code:
local specialRings = {
[ITEMID] = {PrecentDamage = 6, Slot = Legs}},
[ITEMID] = {PrecentDamage = 2, Slot = Amulet}},
[ITEMID] = {PrecentDamage = 22, Slot = Feet}}
},
}
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if creature and attacker then
if attacker:isPlayer() then
local ring = attacker:getSlotItem(CONST_SLOT_RING)
if ring and primaryType == COMBAT_ENERGYDAMAGE then
if table.contains(specialRings, ring.itemid) then
local tmpDamage = primaryDamage
primaryDamage = primaryDamage * 1.05
end
end
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end