• 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!

condition accumulating

RigBy

Member
Joined
Jun 9, 2015
Messages
44
Solutions
1
Reaction score
6
tfs 1.3

I have 2 spells, one that applies a fire DOT and another that increases damage if Player has the DOT.
the DOT is for 5 turns, but when you use the spell more than once on the target the spell reaches more than 15/20dots depending on when I use it.
there is some usual form of 5 shifts
I want to know why this is happening.

dot
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

local condition = Condition(CONDITION_FIRE)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)


function onGetFormulaValues(player, level, maglevel)
    local min = 50
    local max = 50
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    condition:addDamage(5,1000, -20)
    combat:addCondition(condition)
    combat:execute(creature, var)
    return true
end

dano
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
combat2:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)


local ticks = 3 -- Enter the amount of seconds between each damage tick
local repeats = 3 -- Enter the amount of times you want this damage to repeat


function onGetFormulaValues(player, level, maglevel)
    local min = 10
    local max = 10
    return -min, -max
end

function onGetFormulaValuess(player, level, maglevel)
    local min = 50
    local max = 50
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
combat2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValuess")

function onCastSpell(creature, var)
    local target = creature:getTarget()
    if target:getCondition(CONDITION_FIRE) then
    combat2:setParameter(COMBAT_PARAM_DISPEL, CONDITION_FIRE)
    combat2:execute(creature, var)
    else
    combat:execute(creature, var)
    end
    return true
end
Post automatically merged:

I tested using this
Lua:
condition:setParameter(CONDITION_PARAM_PERIODICDAMAGE, -20)

but I don't know how to make the other script check this and remove
 
use CONDITION_PARAM_SUBID to set a subId and then you can use creature:removeCondition(conditionType, CONDITIONID_DEFAULT, subId) and it will remove the one with that subId only
 
use CONDITION_PARAM_SUBID to set a subId and then you can use creature:removeCondition(conditionType, CONDITIONID_DEFAULT, subId) and it will remove the one with that subId only
can fix it for me, because the way I tried it didn't work, pls.

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

local condition = Condition(CONDITION_FIRE)
condition:setParameter(CONDITION_PARAM_SUBID, 100)
condition:setParameter(CONDITION_PARAM_TICKS, 6 * 1000)
condition:setParameter(CONDITION_PARAM_PERIODICDAMAGE, -30)


function onGetFormulaValues(player, level, maglevel)
    local min = 50
    local max = 50
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    combat:addCondition(condition)
    combat:execute(creature, var)
    return true
end

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
combat2:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)



function onGetFormulaValues(player, level, maglevel)
    local min = 10
    local max = 10
    return -min, -max
end

function onGetFormulaValuess(player, level, maglevel)
    local min = 50
    local max = 50
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
combat2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValuess")

function onCastSpell(creature, var)
    local target = creature:getTarget()
    if target:getCondition(CONDITION_FIRE, CONDITIONID_DEFAULT, 100) then
    target:removeCondition(CONDITION_FIRE, CONDITIONID_DEFAULT, 100)
    combat2:execute(creature, var)
    else
    combat:execute(creature, var)
    end
    return true
end
 
I was tested in several ways, but none of them worked, or I applied the dot and didn't remove or didn't apply the dot, but I've been testing it in several different ways and I ended up getting it, I just hope I don't have any bugs hehehe :3

if it's someone who wants to do the same thing, I'll leave the script there.



Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

local condition = createConditionObject(CONDITION_FIRE)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 10, 1000, -20)


function onGetFormulaValues(player, level, maglevel)
    local min = 50
    local max = 50
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    combat:addCondition(condition)
    combat:execute(creature, var)
    return true
end


it increases damage and removes the dot if you don't have the dot, the spell of slow:

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
combat2:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

function onGetFormulaValues(player, level, maglevel)
    local min = 10
    local max = 10
    return -min, -max
end

function onGetFormulaValuess(player, level, maglevel)
    local min = 50
    local max = 50
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
combat2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValuess")

function onCastSpell(creature, var)
    local target = creature:getTarget()
    print(target:getSpeed())
    if target:hasCondition(CONDITION_FIRE) then
    target:removeCondition(CONDITION_FIRE)
    combat2:execute(creature, var)
    else
    local condition = Condition(CONDITION_PARALYZE)
    condition:setParameter(CONDITION_PARAM_TICKS, 2000)
    condition:setFormula(0, -80, 0, -80)
    combat:addCondition(condition)
    combat:execute(creature, var)
    print(target:getSpeed())
    end
    return true
end
Post automatically merged:

have you tried copying the code from cure poison file?
my server doesn't have the spell ignite in the base, I tried to use the ignite who comes in tfs from other servers but it doesn't work, I don't know why :/
 
Back
Top