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

A Condition spell not working

Awesomedudei

Revolutionot.com
Joined
Jan 20, 2010
Messages
444
Solutions
1
Reaction score
202
Location
Sweden
So i have a few spells which are adding a damaging condition
But they're not working as i thought it would?
Like the initial Damage works but there's no condition being set.

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEEAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLICE)

local condition = Condition(CONDITION_FREEZING)
condition:setTicks(4000)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_TICKINTERVAL, 1000)

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 6.3) + 85
    local max = (level / 5) + (magicLevel * 7.8) + 147
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local function CastSpell(cid, var)
    local player = Player(cid)
    local level = player:getLevel()
    local maglevel = player:getMagicLevel()
    min = -((level / 5) + (maglevel * 1.48) + 17)
    max = -((level / 5) + (maglevel * 1.75) + 30)
    condition:setParameter(CONDITION_PARAM_PERIODICDAMAGE, math.random(min,max))
    combat:addCondition(condition)
    return true
    end

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

Something i noticed is. If i for example use utori pox after casting some of the non working spells like above.
It adds those conditions? and kind of queue's them.


This is the utori pox spell
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_CARNIPHILA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

function onTargetCreature(creature, target)
    local min = (creature:getLevel() / 30) + (creature:getMagicLevel() * 0.5) + 15
    local max = (creature:getLevel() / 30) + (creature:getMagicLevel() * 0.7) + 25
    local rounds = math.random(math.floor(min), math.floor(max))
    creature:addDamageCondition(target, CONDITION_ENERGY, DAMAGELIST_VARYING_PERIOD, target:isPlayer() and 13 or 25, {10, 12}, rounds)
end

combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end
 
Solution
Oen helped me figuring out what was wrong and this is the correct way to do this.


Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEEAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLICE)

local condition = Condition(CONDITION_FREEZING)
condition:setTicks(4000)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_TICKINTERVAL, 1000)

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 6.3) + 85
    local max = (level / 5) + (magicLevel * 7.8) + 147
    return -min, -max
end...
Lua:
local function CastSpell(cid, var)
    local player = Player(cid)
    local level = player:getLevel()
    local maglevel = player:getMagicLevel()
    min = -((level / 5) + (maglevel * 1.48) + 17)
    max = -((level / 5) + (maglevel * 1.75) + 30)
    condition:setParameter(CONDITION_PARAM_PERIODICDAMAGE, math.random(min,max))
    combat:addCondition(condition)
    return true
    end
What is this magical function?
 
Oen helped me figuring out what was wrong and this is the correct way to do this.


Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEEAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLICE)

local condition = Condition(CONDITION_FREEZING)
condition:setTicks(4000)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_TICKINTERVAL, 1000)

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 6.3) + 85
    local max = (level / 5) + (magicLevel * 7.8) + 147
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")


function onCastSpell(creature, variant)
    local level = creature:getLevel()
    local maglevel = creature:getMagicLevel()
    local min = -((level / 5) + (maglevel * 1.48) + 17)
    local max = -((level / 5) + (maglevel * 1.75) + 30)
    condition:setParameter(CONDITION_PARAM_PERIODICDAMAGE, math.random(min,max))
    combat:addCondition(condition)
    return combat:execute(creature, variant)
end
 
Solution
Back
Top