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

Rune of healing per second

Remoq

New Member
Joined
Apr 7, 2013
Messages
11
Reaction score
1
Hello!
Looking for a rune script that will heal the other person every second
taking my mana every second. Players must stand next to each other. if someone moves it interrupts the healing. if again I use the rune on a player breaks a healing.

Thank you !
 
I wrote this but it does not work could someone fix me?

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getCreaturePosition(itemEx.uid)
local posc = getCreaturePosition(cid)
    if getPlayerStorageValue(cid, CHARGEF) == 1 then
        doPlayerSendCancel(cid, "Healing friend off")
        setPlayerStorageValue(cid, CHARGEF, 0)
    elseif (getCreatureHealth(itemEx.uid) == getCreatureMaxHealth(itemEx.uid))then
        doPlayerSendCancel(itemEx.uid, "You're fully healthy. ")
        doSendMagicEffect(pos, CONST_ME_POFF)
    elseif (getPlayerMana(cid) <= 20)then
        doPlayerSendCancel(cid, "You don't have enough reiatsu")
        doSendMagicEffect(posc, CONST_ME_POFF)
    else
        doPlayerSendCancel(cid, "Healing friend on")
        setPlayerStorageValue(cid, CHARGEF, 1)
        doCreatureSetNoMove(cid, true)
        addEvent(leczenie, 0, cid)
    end
end 

function leczenie(cid, itemEx)
if isPlayer(itemEx.uid) then
local mlvl = getPlayerMagLevel(cid)
  if (getPlayerMana(cid) >= 20 and (getCreatureHealth(itemEx.uid) ~= getCreatureMaxHealth(itemEx.uid)) and getPlayerStorageValue(cid, CHARGEF) == 1) then 
    doCreatureAddMana(cid, -10, false)
    doCreatureAddHealth(itemEx.uid, mlvl * 2)
    addEvent(leczenie, 2000, cid) 
    doSendMagicEffect(getCreaturePosition(itemEx.uid), CONST_ME_MAGIC_BLUE) 
    else
    doPlayerSendCancel(cid, "Healing friend off")
    stopEvent(leczenie, true)
    doCreatureSetNoMove(cid, false)
    setPlayerStorageValue(cid, CHARGEF, 0)
  end
end
end
 
Writted for you.

Code:
local config = {
    timePerTicks = 1000,
    amountOfTicks = 60,
    tickManaCost = 5
}

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)

function onGetFormulaValues(cid, level, maglevel)
    local bonus = 5
    min = (maglevel + level) * 0.15 + bonus
    max = (maglevel + level) * 0.25 + bonus
    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local function heal(cid, var, pos, tos)
    if isCreature(cid) == true and isCreature(variantToNumber(var)) == true then
        local tos2 = getThingPos(variantToNumber(var))
        local pos2 = getCreaturePosition(cid)
        if tos.x == tos2.x and tos.y == tos2.y and pos.x == pos2.x and pos.y == pos2.y then
            doCombat(cid, combat, var)
            doPlayerAddSpentMana(cid, config.tickManaCost)
        end
    else
        return false
    end
    return true
end

function onCastSpell(cid, var)
    local tos = getThingPos(variantToNumber(var))
    local pos = getCreaturePosition(cid)
    for i = 1, config.amountOfTicks do
        addEvent(heal, i * config.timePerTicks, cid, var, pos, tos)
    end
    return true
end
 
Last edited:
Back
Top