• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ Water attack rune attacks with water but conditions aplied afterward are different

Berciq

Veteran OT User
Joined
Aug 7, 2018
Messages
296
Reaction score
358
Location
Poland
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

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:
Solution
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 =...
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
        doTargetCombatHealth(creature, target, COMBAT_DROWNDAMAGE, -damage, -damage, 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
 
Solution
MAAAAN!!! <3!

ezgif-3-51cae78e9d.gif
one awful line, now it works perfect! THANKS!!

PS: I dont see button best answer between like and quote or anywhere else :( but Your Answer saved my day !
 
Last edited:
Back
Top