• 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+ tfs 1.3 make many conditions in one spell

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
922
Location
Chile
Hello guys, me again ;c im editing this script to give paralize, fire and poison conditions on the same attack, but i cant make it, i have tried many many different ways, but none of them works!! i can't pass the paralize to the other conditions, plz guys i would appreciate the help so much!

LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 1)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, 81)

function onGetFormulaValues(player, level, skill, attack, factor)
local distanceSkill = player:getSkillLevel(SKILL_DISTANCE)
    local min = (level / 2) + (distanceSkill * 1.5) + 25
    local max = (level / 2) + (distanceSkill * 5) + 50
    return -min, -max
end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local repeatCombats = 5
local executeSpell = function(cid, variant)
    local creature = Creature(cid)
    if creature then
        combat:execute(creature, variant)
    end
end



function onCastSpell(creature, variant)
    local ret = combat:execute(creature, variant)
    if ret then
        for current = 1, (repeatCombats-1) do
            addEvent(executeSpell, 200 * current, creature:getId(), variant)
        
         local condition = Condition(CONDITION_PARALYZE)
         condition:setParameter(CONDITION_PARAM_TICKS, 20000)
            condition:setFormula(-1, 80, -1, 80)
         combat:addCondition(condition)
        
         local condition2 = Condition(CONDITION_POISON)
         condition2:setParameter(CONDITION_PARAM_TICKS, 20000)
            condition2:setFormula(-1, 80, -1, 80)
         combat:addCondition(condition2)
        
         local condition3 = Condition(CONDITION_FIRE)
         condition3:setParameter(CONDITION_PARAM_TICKS, 20000)
            condition3:setFormula(-1, 80, -1, 80)
         combat:addCondition(condition3)




        end
    end
    return ret
end
 
Solution
LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 1)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, 20)

local paralyze = Condition(CONDITION_PARALYZE)
paralyze:setParameter(CONDITION_PARAM_TICKS, 20000)
paralyze:setFormula(-1, 80, -1, 80)

function onGetFormulaValues(player, level, skill, attack, factor)
    local distanceSkill = player:getSkillLevel(SKILL_DISTANCE)
    local min = (level / 2) + (distanceSkill * 1.5) + 25
    local max = (level / 2) + (distanceSkill * 5) + 50
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

local executeSpell = function(cid, variant, turn)
    local creature = Creature(cid)...
LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 1)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, 20)

local paralyze = Condition(CONDITION_PARALYZE)
paralyze:setParameter(CONDITION_PARAM_TICKS, 20000)
paralyze:setFormula(-1, 80, -1, 80)

function onGetFormulaValues(player, level, skill, attack, factor)
    local distanceSkill = player:getSkillLevel(SKILL_DISTANCE)
    local min = (level / 2) + (distanceSkill * 1.5) + 25
    local max = (level / 2) + (distanceSkill * 5) + 50
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

local executeSpell = function(cid, variant, turn)
    local creature = Creature(cid)
    local target = Creature(variant.number)
    if creature and turn <= 4 then
        combat:execute(creature, variant)
    end

    if creature and target and turn == 5 then
        local rounds = math.random(5, 10)
        local min, max = 5, 10
        creature:addDamageCondition(target, CONDITION_FIRE, DAMAGELIST_VARYING_PERIOD, math.random(min, max), {2, 4}, rounds)
        creature:addDamageCondition(target, CONDITION_POISON, DAMAGELIST_VARYING_PERIOD, math.random(min, max), {2, 4}, rounds)
        target:addCondition(paralyze)
        combat:execute(creature, variant)
    end
    return true
end

function onCastSpell(creature, variant)
    for i = 5, 1, -1 do
        addEvent(executeSpell, 200 * i, creature:getId(), variant, i)
    end
end
 
Solution
LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 1)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, 20)

local paralyze = Condition(CONDITION_PARALYZE)
paralyze:setParameter(CONDITION_PARAM_TICKS, 20000)
paralyze:setFormula(-1, 80, -1, 80)

function onGetFormulaValues(player, level, skill, attack, factor)
    local distanceSkill = player:getSkillLevel(SKILL_DISTANCE)
    local min = (level / 2) + (distanceSkill * 1.5) + 25
    local max = (level / 2) + (distanceSkill * 5) + 50
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

local executeSpell = function(cid, variant, turn)
    local creature = Creature(cid)
    local target = Creature(variant.number)
    if creature and turn <= 4 then
        combat:execute(creature, variant)
    end

    if creature and target and turn == 5 then
        local rounds = math.random(5, 10)
        local min, max = 5, 10
        creature:addDamageCondition(target, CONDITION_FIRE, DAMAGELIST_VARYING_PERIOD, math.random(min, max), {2, 4}, rounds)
        creature:addDamageCondition(target, CONDITION_POISON, DAMAGELIST_VARYING_PERIOD, math.random(min, max), {2, 4}, rounds)
        target:addCondition(paralyze)
        combat:execute(creature, variant)
    end
    return true
end

function onCastSpell(creature, variant)
    for i = 5, 1, -1 do
        addEvent(executeSpell, 200 * i, creature:getId(), variant, i)
    end
end
omg thank youuuuuu i tried this for like 3 hours xD thanks!!!
 
For future references:
The script didn't work for Thorn (While it works in a fresh TFS 1.3 downloaded from git), I tried to help him via PM unsuccessfully, and after I offered help via Teamviewer (Thing that almost no one do for free) he acted all defensive.
This message is not meant to actually meant anything but just for future reference for me.

As a last recommendation to Thorn I recommend downloading TFS 1.3 and pass your things there.
I will not answer future private messages about this thread.
 
Back
Top