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

Utura level scaling

liqeen

Active Member
Joined
Nov 26, 2014
Messages
151
Solutions
1
Reaction score
30
Location
Poland
Hello, can someone help me to make this work? Im trying to do utura spell that scales with level but with misery effect..

Thats my code so far, it does not send any error but dont heal either.

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)


function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 6.9) + 40
    local max = (level / 5) + (maglevel * 13.2) + 82
    return min, max
end

local condition = Condition(CONDITION_REGENERATION)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
condition:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
condition:setParameter(CONDITION_PARAM_HEALTHGAIN, "onGetFormulaValues")
condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 3000)
combat:setCondition(condition)


function onCastSpell(creature, var)
    return combat:execute(creature, var)
end
 
try this

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local condition = Condition(CONDITION_REGENERATION)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
condition:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)

condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 3000)
combat:setCondition(condition)

function onCastSpell(creature, var)
    if creature:isMonster() then
         return false
    end
    local level = creature:getLevel()
    local mlvl = creature:getMagicLevel()
    local min = (level / 5) + (mlvl * 6.9) + 40
    local max = (level / 5) + (mlvl * 13.2) + 82
    local healthGain = math.random(min, max)
    condition:setParameter(CONDITION_PARAM_HEALTHGAIN, healthGain)
    return combat:execute(creature, var)
end
 
Last edited:
try this

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local condition = Condition(CONDITION_REGENERATION)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
condition:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)

condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 3000)
combat:setCondition(condition)

function onCastSpell(creature, var)
    if creature:isMonster() then
         return false
    end
    local level = creature:getLevel()
    local mlvl = creature:getMagicLevel()
    local min = (level / 5) + (mlvl * 6.9) + 40
    local max = (level / 5) + (mlvl * 13.2) + 82
    local healthGain = math.random(min, max)
    condition:setParameter(CONDITION_PARAM_HEALTHGAIN, healthGain)
    return combat:execute(creature, var)
end
Still the same thing, no error in console but aint healing either
 
which distro are you using
this one malucooo/otxserver-new (https://github.com/malucooo/otxserver-new)
Btw
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)


local function eventRegeneration(playerId, seconds)
    local player = Player(playerId)
    if seconds > 0 and player then
        local healvalue = ((player:getLevel() * 2) + (player:getMagicLevel() * 2))
        player:addHealth(healvalue)
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
        addEvent(eventRegeneration, 1000, playerId, seconds - 1)
    end
end

local coolDownStorageID = 666777
local coolDownSeconds = 2

function onCastSpell(player, variant)
    if player:getStorageValue(coolDownStorageID) <= os.time() then
        player:setStorageValue(coolDownStorageID, os.time() + (coolDownSeconds - 1))
        return eventRegeneration(player:getId(), coolDownSeconds)
        
    end
    return not player:sendCancelMessage("You are exhausted.")
    
end
This one does work but it does not say anything while casted (I mean the orange text over a character) dunno how to fix it
 
Back
Top