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

Rune heal mana and hp not working tfs 0.3

trowares

New Member
Joined
May 24, 2017
Messages
7
Reaction score
0
Hello guys, im new here in otland...
im developing a project and i need your help

i have this script
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_MANADRAIN)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
function onGetFormulaValues(cid, level, maglevel)
    local min = (getCreatureMaxMana(cid) / 100) * 8
    local max = (getCreatureMaxMana(cid) / 100) * 11
    return min, max
end
function onGetFormulaValues(cid, level, maglevel)
    local min = (getCreatureMaxHealth(cid) / 100) * 15
    local max = (getCreatureMaxHealth(cid) / 100) * 20
    return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")


function onCastSpell(cid, var)  
    return doCombat(cid, combat, var)
end

and it doesn't work, what i want it that it heals both mana and hp
i already have one manarune and one superuh and i did a mix of both but didn't work, could you help me plz?
thanks!!

TFS 0.3
 
Solution
scripts/rune.lua [Also u will need add the rune on Spells.xml for choose the vocations than can use)
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(cid, var)
doPlayerAddMana(cid, 1)
return doCombat(cid, combat, var)
end

Also actions/scripts/rune.lua
LUA:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mana_minimum = (getCreatureMaxMana(cid) / 100) * 8
    local...
scripts/rune.lua [Also u will need add the rune on Spells.xml for choose the vocations than can use)
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(cid, var)
doPlayerAddMana(cid, 1)
return doCombat(cid, combat, var)
end

Also actions/scripts/rune.lua
LUA:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mana_minimum = (getCreatureMaxMana(cid) / 100) * 8
    local mana_maximum = (getCreatureMaxMana(cid) / 100) * 15
    local mana_add = math.random(mana_minimum, mana_maximum)

    local health_minimum = (getCreatureMaxHealth(cid) / 100) * 15
    local health_maximum = (getCreatureMaxHealth(cid) / 100) * 20
    local health_add = math.random(health_minimum, health_maximum)
 
    doPlayerAddMana(cid, mana_add)
    doCreatureAddHealth(cid, health_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
    return TRUE
end
actions.xml add: "xxxx" id of the rune
XML:
    <action itemid="xxxx" script="rune.lua" allowfaruse="1" blockwalls="0" />
 
Last edited:
Solution
scripts/rune.lua [Also u will need add the rune on Spells.xml for choose the vocations than can use)
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(cid, var)
doPlayerAddMana(cid, 1)
return doCombat(cid, combat, var)
end

Also actions/scripts/rune.lua
LUA:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mana_minimum = (getCreatureMaxMana(cid) / 100) * 8
    local mana_maximum = (getCreatureMaxHealth(cid) / 100) * 15
    local mana_add = math.random(mana_minimum, mana_maximum)

    local health_minimum = (getCreatureMaxHealth(cid) / 100) * 15
    local health_maximum = (getCreatureMaxHealth(cid) / 100) * 20
    local health_add = math.random(health_minimum, health_maximum)
 
    doPlayerAddMana(cid, mana_add)
    doCreatureAddHealth(cid, health_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
    return TRUE
end
actions.xml add: "xxxx" id of the rune
XML:
    <action itemid="xxxx" script="rune.lua" allowfaruse="1" blockwalls="0" />

Thanks for answering!
I have a question, is this function right?
Code:
local mana_maximum = (getCreatureMaxHealth(cid) / 100) * 15

Again, Thanks for your time!
 
Oh right a little mistake when i was copying your formula sorry haha, no problem ;p
Post edited!
Hello sorry to bother again :/ but the rune can be used by any vocation, not just paladins and royal paladins...
Code:
<rune name="Paladin Ultimate Healing Rune" id="2270" allowfaruse="1" charges="1" lvl="8" maglv="8" exhaustion="400" aggressive="0" needtarget="1" blocktype="solid" script="healing/palyrune.lua">
        <vocation name="Paladin"/>
        <vocation name="Royal Paladin" showInDescription="0"/>
    </rune>

I realized that everyone is using the rune, and is not fair haha. Plis Help!

Oh and also when you use this rune, you stop attacking, is there a way that this doesn't happen?
 
Last edited:

actions/scripts/rune.lua

LUA:
local vocations = {3, 7} -- vocation id of Paladin / Royal Paladin
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not isInArray(vocations, getPlayerVocation(cid)) then
        return doPlayerSendTextMessage(MESSAGE_STATUS_SMALL, "Your vocation cannot use this rune.")
    end
    local mana_minimum = (getCreatureMaxMana(cid) / 100) * 8
    local mana_maximum = (getCreatureMaxMana(cid) / 100) * 15
    local mana_add = math.random(mana_minimum, mana_maximum)
    local health_minimum = (getCreatureMaxHealth(cid) / 100) * 15
    local health_maximum = (getCreatureMaxHealth(cid) / 100) * 20
    local health_add = math.random(health_minimum, health_maximum)
    doPlayerAddMana(cid, mana_add)
    doCreatureAddHealth(cid, health_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
    return true
end

I am not sure how @Carlitos Flow wanted to link actions with spells but this is temporary solution until he comes back
 
actions/scripts/rune.lua

LUA:
local vocations = {3, 7} -- vocation id of Paladin / Royal Paladin
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not isInArray(vocations, getPlayerVocation(cid)) then
        return doPlayerSendTextMessage(MESSAGE_STATUS_SMALL, "Your vocation cannot use this rune.")
    end
    local mana_minimum = (getCreatureMaxMana(cid) / 100) * 8
    local mana_maximum = (getCreatureMaxMana(cid) / 100) * 15
    local mana_add = math.random(mana_minimum, mana_maximum)
    local health_minimum = (getCreatureMaxHealth(cid) / 100) * 15
    local health_maximum = (getCreatureMaxHealth(cid) / 100) * 20
    local health_add = math.random(health_minimum, health_maximum)
    doPlayerAddMana(cid, mana_add)
    doCreatureAddHealth(cid, health_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
    return true
end

I am not sure how @Carlitos Flow wanted to link actions with spells but this is temporary solution until he comes back




im sorry but everytime people use this rune this error is poping out in console

Code:
[6/6/2017 9:32:57] [Error - Action Interface]
[6/6/2017 9:32:57] data/actions/scripts/palyrune.lua:onUse
[6/6/2017 9:32:57] Description:
[6/6/2017 9:32:57] (LuaInterface::luaDoPlayerSendTextMessage) Player not found
 
im sorry but everytime people use this rune this error is poping out in console

Code:
[6/6/2017 9:32:57] [Error - Action Interface]
[6/6/2017 9:32:57] data/actions/scripts/palyrune.lua:onUse
[6/6/2017 9:32:57] Description:
[6/6/2017 9:32:57] (LuaInterface::luaDoPlayerSendTextMessage) Player not found

LUA:
local vocations = {3, 7} -- vocation id of Paladin / Royal Paladin
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not isInArray(vocations, getPlayerVocation(cid)) then
        return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "Your vocation cannot use this rune.")
    end
    local mana_minimum = (getCreatureMaxMana(cid) / 100) * 8
    local mana_maximum = (getCreatureMaxMana(cid) / 100) * 15
    local mana_add = math.random(mana_minimum, mana_maximum)
    local health_minimum = (getCreatureMaxHealth(cid) / 100) * 15
    local health_maximum = (getCreatureMaxHealth(cid) / 100) * 20
    local health_add = math.random(health_minimum, health_maximum)
    doPlayerAddMana(cid, mana_add)
    doCreatureAddHealth(cid, health_add)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
    return true
end
 
Back
Top