• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Tfs 1.2 manarune

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,175
Solutions
17
Reaction score
481
Location
Sweden
Hello,
I have no clue how to make a manarune calculate healing for Xlevel
For example a level 100 will heal around 1k mana meanwhile a level 1.5k will heal around 1.5k mana, it should depend on the mglvl.
The thing i want is simple to make a fair manarune so the same manarune at level 100 should be the same at level 1000 but with bigger healing but the same fair healing system if i explain it right.
LUA:
local mana = 500
local color = TEXTCOLOR_YELLOW

function onUse(player, item, fromPosition, target, toPosition)
    player:addMana(mana)
    player:sendTextMessage(MESSAGE_HEALED, "You have healed ".. mana .. " mana.", player:getPosition(), mana, color)
    player:sendMagicEffect(CONST_ME_HOLYAREA)
    return true
end
 
Solution
Hello,
I have no clue how to make a manarune calculate healing for Xlevel
For example a level 100 will heal around 1k mana meanwhile a level 1.5k will heal around 1.5k mana, it should depend on the mglvl.
The thing i want is simple to make a fair manarune so the same manarune at level 100 should be the same at level 1000 but with bigger healing but the same fair healing system if i explain it right.
LUA:
local mana = 500
local color = TEXTCOLOR_YELLOW

function onUse(player, item, fromPosition, target, toPosition)
    player:addMana(mana)
    player:sendTextMessage(MESSAGE_HEALED, "You have healed ".. mana .. " mana.", player:getPosition(), mana, color)
    player:sendMagicEffect(CONST_ME_HOLYAREA)
    return true
end
...
Hello,
I have no clue how to make a manarune calculate healing for Xlevel
For example a level 100 will heal around 1k mana meanwhile a level 1.5k will heal around 1.5k mana, it should depend on the mglvl.
The thing i want is simple to make a fair manarune so the same manarune at level 100 should be the same at level 1000 but with bigger healing but the same fair healing system if i explain it right.
LUA:
local mana = 500
local color = TEXTCOLOR_YELLOW

function onUse(player, item, fromPosition, target, toPosition)
    player:addMana(mana)
    player:sendTextMessage(MESSAGE_HEALED, "You have healed ".. mana .. " mana.", player:getPosition(), mana, color)
    player:sendMagicEffect(CONST_ME_HOLYAREA)
    return true
end
MESSAGE_HEALED only uses digits and makes it look like you were healing so this isn't useful in this instance. If you still want to use that sendTextMesssage line then I suggest you use MESSAGE_STATUS_SMALL instead.

I just took the formulas from the ultimate healing rune to make this so just adjust the min and max formulas if you want it to heal more or less.
LUA:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not target or not target:isPlayer() then
        return false
    end

    local level, magicLevel = player:getLevel(), player:getMagicLevel()
    local min = (level / 5) + (magicLevel * 7.3) + 42
    local max = (level / 5) + (magicLevel * 12.4) + 90

    local mana = math.random(min, max)

    target:addMana(mana)
    toPosition:sendMagicEffect(CONST_ME_HOLYAREA)
    return true
end
Also if you want it to remove a rune on each use then add this just before return true:
LUA:
item:remove(1)
 
Solution
MESSAGE_HEALED only uses digits and makes it look like you were healing so this isn't useful in this instance. If you still want to use that sendTextMesssage line then I suggest you use MESSAGE_STATUS_SMALL instead.

I just took the formulas from the ultimate healing rune to make this so just adjust the min and max formulas if you want it to heal more or less.
LUA:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not target or not target:isPlayer() then
        return false
    end

    local level, magicLevel = player:getLevel(), player:getMagicLevel()
    local min = (level / 5) + (magicLevel * 7.3) + 42
    local max = (level / 5) + (magicLevel * 12.4) + 90

    local mana = math.random(min, max)

    target:addMana(mana)
    toPosition:sendMagicEffect(CONST_ME_HOLYAREA)
    return true
end
Also if you want it to remove a rune on each use then add this just before return true:
LUA:
item:remove(1)
Does not work, it still adds 500 mana..
 
Does not work, it still adds 500 mana..
It definitely shouldn't only be 500. Did you make sure that is the only thing you put inside the lua script and didn't forget to remove your local variables outside the function. Like remove these:
LUA:
local mana = 500
local color = TEXTCOLOR_YELLOW
 
It definitely shouldn't only be 500. Did you make sure that is the only thing you put inside the lua script and didn't forget to remove your local variables outside the function. Like remove these:
LUA:
local mana = 500
local color = TEXTCOLOR_YELLOW
Yes, i took your code and removed the rest so it's only yours inside, the lua was changed and restarted the server.
 
Never mind, i was blind i edited it but it didn't save.. thought it was located somewhere else than Actions and found out that the file didn't change for some reason, thanks alot it works fine.
 

Similar threads

Back
Top