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

Spell Rune damange by level

miguelshta

Member
Joined
Mar 21, 2009
Messages
351
Solutions
1
Reaction score
13
Location
Toronto, Canada
Hello, how i can set up this spell rune to give damage by level example:
Level 1 ~ 100 damage =1 ~ 110
Level 101 ~ 250 damage = 200 ~ 350

Lua:
local config = {
    combat = COMBAT_ICEDAMAGE,
    distanceEffect = 25,
    rounds = 6,
    delay = 150,
    firstEffect = 38,
    secondEffect = 41
}

local acombat, combat = createCombatObject(), createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, config.combat)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, config.combat)

local arr1 = {
    {0, 0, 1, 1, 1, 0, 0},
    {0, 1, 1, 1, 1, 1, 0},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 3, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {0, 1, 1, 1, 1, 1, 0},
    {0, 0, 1, 1, 1, 0, 0}
}

setCombatArea(combat2, createCombatArea(arr1))
setCombatArea(acombat, createCombatArea(arr1))

function onGetFormulaValues(player, skill, attack, factor)
    local min = 215
    local max = 230
    return -(min), -(max)
end

setCombatCallback(combat2, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onGetFormulaValues(player, skill, attack, factor)
    local min = 0
    local max = 0
    return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

local effect = {config.firstEffect,config.secondEffect}
function onTargetTile(cid, pos)
    return math.random(2) == 1 and pos:sendMagicEffect(effect[math.random(#effect)]) and  doSendDistanceShoot({ x = pos.x - 7, y = pos.y - 7, z = pos.z}, pos, 36) and doCombat(cid, combat, positionToVariant(pos))
end

setCombatCallback(acombat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

local function doTimeCombat(cid, combat, var)
     if isPlayer(cid) then
         doCombat(cid, combat, var)
         doCombat(cid, combat2, var)
     end
     return true
end

function onCastSpell(cid, var)
    local player = Player(cid)
     for x = 1, config.rounds do
         addEvent(doTimeCombat, (x-1) * config.delay, cid.uid, acombat, var)
     end
     return true
end
 
Idk im not scripter but u can try:
function onGetFormulaValues(player, skill, attack, factor)
local min = 215
local max = 230
return -(min), -(max)
end
change to
function onGetFormulaValues(player, skill, level, attack, factor)
local min = 5 * level + 5 --then your min damage = 5 * 10 level + 5 = 55dmg with 10 level
local max = 10 * level + 15 -- then your max damage = 10 * 10 level + 15 = 115dmg with 10 level
return -(min), -(max)
end
BUT im NOT scripter and i not tested but u can try and wait for new helpers with your problem.
 
If you use COMBAT_FORMULA_LEVELMAGIC you can try:
Lua:
function onGetFormulaValues(player, level, maglevel)
    local min = 100 * level
    local max = 200 * level
    return -min, -max
end

But if you use COMBAT_FORMULA_SKILL you can try:
Lua:
function onGetFormulaValues(player, skill, attack, factor)
    local level = player:getLevel()
    local min = 100 * level
    local max = 200 * level
    return -min, -max
end
 
Lua:
local config = {
    combat = COMBAT_ICEDAMAGE,
    distanceEffect = 25,
    rounds = 6,
    delay = 150,
    firstEffect = 38,
    secondEffect = 41
}

local levelRange = {
    [1] = {
        minLevel = 1,
        maxLevel = 100,
        multiplier = 1.1, -- When the character is level 100, the damage will be 110.
    },
    [2] = {
        minLevel = 101,
        maxLevel = 250,
        multiplier = 1.4, -- When the character is level 250, the damage will be 350.
    },
    [3] = {
        minLevel = 251,
        maxLevel = 999999,
        multiplier = 1.7, -- When the character is level 251, the damage will be 426.
    },
}

local acombat, combat = createCombatObject(), createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, config.combat)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, config.combat)

local arr1 = {
    { 0, 0, 1, 1, 1, 0, 0 },
    { 0, 1, 1, 1, 1, 1, 0 },
    { 1, 1, 1, 1, 1, 1, 1 },
    { 1, 1, 1, 3, 1, 1, 1 },
    { 1, 1, 1, 1, 1, 1, 1 },
    { 0, 1, 1, 1, 1, 1, 0 },
    { 0, 0, 1, 1, 1, 0, 0 }
}

setCombatArea(combat2, createCombatArea(arr1))
setCombatArea(acombat, createCombatArea(arr1))

function onGetFormulaValues(player, skill, attack, factor)
    for i = 1, 3, 1 do
        playerLevel = player:getLevel()
        if playerLevel >= levelRange[i].minLevel and playerLevel <= levelRange[i].maxLevel then
            local max = playerLevel * levelRange[i].multiplier
            local min = (max * 0.9)
            return -min, -max
        end
    end
end

setCombatCallback(combat2, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onGetFormulaValues(player, skill, attack, factor)
    local min = 0
    local max = 0
    return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

local effect = { config.firstEffect, config.secondEffect }
function onTargetTile(cid, pos)
    return math.random(2) == 1 and pos:sendMagicEffect(effect[math.random(#effect)]) and
        doSendDistanceShoot({ x = pos.x - 7, y = pos.y - 7, z = pos.z }, pos, 36) and
        doCombat(cid, combat, positionToVariant(pos))
end

setCombatCallback(acombat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function doTimeCombat(cid, combat, var)
    if isPlayer(cid) then
        doCombat(cid, combat, var)
        doCombat(cid, combat2, var)
    end
    return true
end

function onCastSpell(cid, var)
    local player = Player(cid)
    for x = 1, config.rounds do
        addEvent(doTimeCombat, (x - 1) * config.delay, cid.uid, acombat, var)
    end
    return true
end
Post automatically merged:

When the character is level 100, the damage will be 110.
When the character is level 250, the damage will be 350.
When the character is level 251, the damage will be 426.
 
Back
Top