Hey, I have this rune which attacks with water and then it should give condition of drowning 10 times which would take 1/20 of damage along 4 seconds (so hits every 400ms).
Almost everything works as inteded, but when first damage is from water, the next damages from conditions are non element (displayed as purple),
I wish all hits to be from water and display drowning condition under eq table, do You know where and what should i place? something with conditions?
TFS 1.3
Almost everything works as inteded, but when first damage is from water, the next damages from conditions are non element (displayed as purple),
I wish all hits to be from water and display drowning condition under eq table, do You know where and what should i place? something with conditions?
TFS 1.3
LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DROWNDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_WATERSPLASH)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
function onGetFormulaValues(player, level, magicLevel)
local min = -((( level / 5 ) + ( magicLevel * 10) + 0 ) / 2 ) -- This is basic damage minimum split by 2
local max = -((( level / 5 ) + ( magicLevel * 10) + 0 ) / 2 ) -- This is basic damage maximum
return min, max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
local function applyDamage(creatureId, targetId, damage)
local creature = Creature(creatureId)
local target = Creature(targetId)
if target and target:isCreature() then
target:addHealth(-damage)
target:getPosition():sendMagicEffect(CONST_ME_WATERSPLASH)
end
end
function onTargetCreature(creature, target)
local level = creature:getLevel()
local magicLevel = creature:getMagicLevel()
local min = ((level / 5) + (magicLevel * 10) + 0 / 2 ) -- This is additional damage, I make them same as basic damage
local max = ((level / 5) + (magicLevel * 10) + 0 / 2 ) -- make same as formula values
local totalDamage = (min + max) / 2 -- Average damage
local damagePerHit = totalDamage / 20 -- Split the total damage over 10 hits
for i = 1, 10 do
addEvent(applyDamage, i * (4000/10), creature:getId(), target:getId(), damagePerHit) -- damage is done 10 times during 4 seconds
end
end
combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
function onCastSpell(creature, variant, isHotkey)
return combat:execute(creature, variant)
end
Last edited: