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

Lua Damage bonus on the 3 attack (spell) TSF 1.3

Icaraii

Well-Known Member
Joined
Jan 5, 2020
Messages
469
Solutions
1
Reaction score
58
Hello guys,

I would like a normal spell (like exori con), that when the player cast it for the 3 time, it will deal 50% more damage. Everytime it is the 3 cast, the effect will be different.
 
Solution
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)

local combat2 = Combat() -- every 3 hit
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
combat2:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
combat2:setParameter(COMBAT_PARAM_BLOCKARMOR, true)

function onGetFormulaValues(player, skill, attack, factor)
    local distanceSkill = player:getEffectiveSkillLevel(SKILL_DISTANCE)
    local min = (player:getLevel() / 5) +...
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)

local combat2 = Combat() -- every 3 hit
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
combat2:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
combat2:setParameter(COMBAT_PARAM_BLOCKARMOR, true)

function onGetFormulaValues(player, skill, attack, factor)
    local distanceSkill = player:getEffectiveSkillLevel(SKILL_DISTANCE)
    local min = (player:getLevel() / 5) + distanceSkill * 0.7
    local max = (player:getLevel() / 5) + distanceSkill + 5
    return -min, -max
end

function onGetFormulaValues2(player, skill, attack, factor) -- every 3 hit
    local distanceSkill = player:getEffectiveSkillLevel(SKILL_DISTANCE)
    local min = (player:getLevel() / 15) + distanceSkill * 0.7
    local max = (player:getLevel() / 15) + distanceSkill + 5
    return -min, -max
end


combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
combat2:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues2")

function onCastSpell(creature, variant)
    if creature:getStorageValue(99999) >= 2 then
        creature:setStorageValue(99999, 0)
        combat2:execute(creature, variant)
        return true
    end
    combat:execute(creature, variant)
    creature:setStorageValue(99999, creature:getStorageValue(99999) + 1)
    return true
end

Idk if theres a other way how this could be made xD
 
Solution
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)

local combat2 = Combat() -- every 3 hit
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
combat2:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
combat2:setParameter(COMBAT_PARAM_BLOCKARMOR, true)

function onGetFormulaValues(player, skill, attack, factor)
    local distanceSkill = player:getEffectiveSkillLevel(SKILL_DISTANCE)
    local min = (player:getLevel() / 5) + distanceSkill * 0.7
    local max = (player:getLevel() / 5) + distanceSkill + 5
    return -min, -max
end

function onGetFormulaValues2(player, skill, attack, factor) -- every 3 hit
    local distanceSkill = player:getEffectiveSkillLevel(SKILL_DISTANCE)
    local min = (player:getLevel() / 15) + distanceSkill * 0.7
    local max = (player:getLevel() / 15) + distanceSkill + 5
    return -min, -max
end


combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
combat2:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues2")

function onCastSpell(creature, variant)
    if creature:getStorageValue(99999) >= 2 then
        creature:setStorageValue(99999, 0)
        combat2:execute(creature, variant)
        return true
    end
    combat:execute(creature, variant)
    creature:setStorageValue(99999, creature:getStorageValue(99999) + 1)
    return true
end

Idk if theres a other way how this could be made xD
Ow, nice thinking, I wasn't close to that line of thinking. It's easy and simple. Work flawless.
 
Last edited:
Back
Top