• 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 doesn't heal

DreadShi

Member
Joined
May 18, 2019
Messages
180
Reaction score
7
i have an issue with manarune script it just showing effects without any healing action
Code:
setCombatArea(combat2_Brush_2,createCombatArea({{0, 1, 0},
{1, 2, 1},
{0, 1, 0}}))
function getDmg_Brush_2(cid, level, maglevel)
    return (2000),(3000)
end
setCombatCallback(combat2_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")
local dfcombat2_Brush_2 = {CONST_ANI_SMALLICE,0,1,-1,0,1,0,0,-1}

-- Areas/Combat for 100ms
local combat1_Brush = createCombatObject()
setCombatParam(combat1_Brush, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatArea(combat1_Brush,createCombatArea({{0, 1, 0},
{1, 2, 1},
{0, 1, 0}}))
function getDmg_Brush(cid, level, maglevel)
    return (5000),(7000)
end
setCombatCallback(combat1_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat1_Brush = {CONST_ANI_ENERGYBALL,-1,0,0,-1,0,1,1,0}

-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatArea(combat0_Brush,createCombatArea({{0, 1, 0},
{1, 2, 1},
{0, 1, 0}}))
function getDmg_Brush(cid, level, maglevel)
    return (5000),(7000)
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat0_Brush = {CONST_ANI_ENERGYBALL,-1,0,1,0,0,1,0,-1}

-- Areas/Combat for 300ms
local combat3_Brush_2 = createCombatObject()
setCombatParam(combat3_Brush_2, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatArea(combat3_Brush_2,createCombatArea({{0, 1, 0},
{1, 2, 1},
{0, 1, 0}}))
function getDmg_Brush_2(cid, level, maglevel)
    return (2000),(3000)
end
setCombatCallback(combat3_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")
local dfcombat3_Brush_2 = {CONST_ANI_SMALLICE,0,1,-1,0,1,0,0,-1}

-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
    if (isCreature(cid)) then
        doCombat(cid, c, var)
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
                i = i + 2
            end       
        end
    end
end

function onCastSpell(creature, var)
local cid = creature:getId()
    local startPos = getCreaturePosition(cid)
    addEvent(RunPart,200,combat2_Brush_2,cid,var,dfcombat2_Brush_2,startPos)
    addEvent(RunPart,100,combat1_Brush,cid,var,dfcombat1_Brush,startPos)
    RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
    addEvent(RunPart,300,combat3_Brush_2,cid,var,dfcombat3_Brush_2,startPos)
    return true
end
 
Solution
[Warning - CallBack::loadCallBack] Event onRavioliRavioli not found.
[Warning - CallBack::loadCallBack] Event onRavioliRavioli2 not found.
[Warning - Event::checkScript] Event onCastSpell not found. scripts/energyballs.lua
[Warning - CallBack::loadCallBack] Event onRavioliRavioli not found.
[Warning - CallBack::loadCallBack] Event onRavioliRavioli2 not found.
[Warning - Event::checkScript] Event onCastSpell not found. scripts/healing/donatormana.lua

Ok, I take it you are registering this through the spells.xml file? In that case we don't need to create a spell object. It's looking for a raw onCastSpell, because everything is already is created and set when the XML is read.

I'm not sure why it's having a problem with the...
Script looks like 0.4 but people tend to copy/paste scripts from older TFS versions to newer ones and expect them to work that's why I have to ask everytime. (They are supposed to post their TFS version without asking).
 
Script looks like 0.4 but people tend to copy/paste scripts from older TFS versions to newer ones and expect them to work that's why I have to ask everytime. (They are supposed to post their TFS version without asking).
Using TFS 1.3 and this spell made by spellcreator also tried to make the character say the healed amount but i couldn't
 
Spell itself working regardless errors
okay i list the problems with you script.

First
LUA:
COMBAT_HEALING
does not heal mana, this is what will heal mana
LUA:
player:addMana(-insert mana gained via number or math-)
which itself needs "player" to be defined either in the function like this
LUA:
function onCastSpell(cid, player, var)
or how i had to do it on my manarune
LUA:
local player = Player(cid)
you will have to do the later to make "addmana" to work

Next, this bit of code is old and need updated though idk if this will effect anything, i did it because my scrip was crashing my server due to how outdated it was.
LUA:
setCombatParam
to this
LUA:
combat:setParameter

it might be my version of tfs sense its in a weird spot but this
LUA:
doCombat(cid, c, var)
causes me errors
i had to change it to this in my script
LUA:
return doCombat(cid, combat, var)
and put it at the end for the return.

For animated text its deprecated due to new tibia clients removing compatibility, there is source edits you can do that will add it back in, just have too use otclient or downgrade from new versions to older versions. Just check c++ for the source edits needed.
Post automatically merged:

oh and if you update the combat parameter part make sure to define combat with this

LUA:
local combat = Combat()
 
I'm trying my hand at porting this for you right now. But one problem I note, even as it is, is that combat2_Brush_2 does not get combat object defined.
Post automatically merged:

This is my best coder guess, having never used Revscriptsys or whatever its called.

LUA:
local function cCA()
    return createCombatArea({
        {0, 1, 0},
        {1, 2, 1},
        {0, 1, 0}
    })
end

function onRavioliRavioli(player, level, magicLevel)
    -- what we want
    player:addMana(math.random(5000, 7000))
    -- not really using this
    local min = (level / 5) + (magicLevel * 3.2) + 20
    local max = (level / 5) + (magicLevel * 5.4) + 40
    return min, max
end
function onRavioliRavioli2(player, level, magicLevel)
    -- what we want
    player:addMana(math.random(2000, 3000))
    -- not really using this
    local min = (level / 5) + (magicLevel * 3.2) + 20
    local max = (level / 5) + (magicLevel * 5.4) + 40
    return min, max
end


local combat0_Brush   = Combat()
local combat1_Brush   = Combat()
local combat2_Brush_2 = Combat()
local combat3_Brush_2 = Combat()

local dfcombat0_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  1,  0, 0, 1, 0, -1}
local dfcombat1_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  0, -1, 0, 1, 1,  0}
local dfcombat2_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}
local dfcombat3_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}

combat0_Brush:setArea(   cCA())
combat1_Brush:setArea(   cCA())
combat2_Brush_2:setArea( cCA())
combat3_Brush_2:setArea( cCA())

combat0_Brush:setCallback(  CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli")
combat1_Brush:setCallback(  CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli")
combat2_Brush_2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli2")
combat3_Brush_2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli2")

combat0_Brush:setParameter(  COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat1_Brush:setParameter(  COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat2_Brush_2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat3_Brush_2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)

--== Magic Effects? ==--
local function RunPart(brush, caster, target, dirList, originPoint) -- Part
    if (isCreature(caster)) then
        doCombat(caster, brush, target)
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                local targetPoint = {
                    x = originPoint.x-dirList[i], 
                    y = originPoint.y-dirList[i+1],
                    z = originPoint.z
                }
                Position(originPoint):sendDistanceEffect(targetPoint, dirList[1])
                i = i + 2
            end       
        end
    end
end

local spell = Spell(SPELL_INSTANT)

function spell.onCastSpell(creature, variant, isHotkey)
    local startPos = creature:getPosition()

    local cid = creature:getId()
    local player = Player(cid) -- Dont think this is actually needed here, but shouldn't hurt

             RunPart(      combat0_Brush,   cid, variant, dfcombat0_Brush,   startPos)
    addEvent(RunPart, 100, combat1_Brush,   cid, variant, dfcombat1_Brush,   startPos)
    addEvent(RunPart, 200, combat2_Brush_2, cid, variant, dfcombat2_Brush_2, startPos)
    addEvent(RunPart, 300, combat3_Brush_2, cid, variant, dfcombat3_Brush_2, startPos)

    return
end
 
Last edited:
I'm trying my hand at porting this for you right now. But one problem I note, even as it is, is that combat2_Brush_2 does not get combat object defined.
Post automatically merged:

This is my best coder guess, having never used Revscriptsys or whatever its called.

LUA:
local function cCA()
    return createCombatArea({
        {0, 1, 0},
        {1, 2, 1},
        {0, 1, 0}
    })
end

function onRavioliRavioli(player, level, magicLevel)
    -- what we want
    player:addMana(math.random(5000, 7000))
    -- not really using this
    local min = (level / 5) + (magicLevel * 3.2) + 20
    local max = (level / 5) + (magicLevel * 5.4) + 40
    return min, max
end
function onRavioliRavioli2(player, level, magicLevel)
    -- what we want
    player:addMana(math.random(2000, 3000))
    -- not really using this
    local min = (level / 5) + (magicLevel * 3.2) + 20
    local max = (level / 5) + (magicLevel * 5.4) + 40
    return min, max
end


local combat0_Brush   = Combat()
local combat1_Brush   = Combat()
local combat2_Brush_2 = Combat()
local combat3_Brush_2 = Combat()

local dfcombat0_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  1,  0, 0, 1, 0, -1}
local dfcombat1_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  0, -1, 0, 1, 1,  0}
local dfcombat2_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}
local dfcombat3_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}

combat0_Brush:setArea(   cCA())
combat1_Brush:setArea(   cCA())
combat2_Brush_2:setArea( cCA())
combat3_Brush_2:setArea( cCA())

combat0_Brush:setCallback(  CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli")
combat1_Brush:setCallback(  CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli")
combat2_Brush_2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli2")
combat3_Brush_2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli2")

combat0_Brush:setParameter(  COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat1_Brush:setParameter(  COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat2_Brush_2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat3_Brush_2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)

--== Magic Effects? ==--
local function RunPart(brush, caster, target, dirList, originPoint) -- Part
    if (isCreature(caster)) then
        doCombat(caster, brush, target)
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                local targetPoint = {
                    x = originPoint.x-dirList[i],
                    y = originPoint.y-dirList[i+1],
                    z = originPoint.z
                }
                Position(originPoint):sendDistanceEffect(targetPoint, dirList[1])
                i = i + 2
            end      
        end
    end
end

local spell = Spell(SPELL_INSTANT)

function spell.onCastSpell(creature, variant, isHotkey)
    local startPos = creature:getPosition()

    local cid = creature:getId()
    local player = Player(cid) -- Dont think this is actually needed here, but shouldn't hurt

             RunPart(      combat0_Brush,   cid, variant, dfcombat0_Brush,   startPos)
    addEvent(RunPart, 100, combat1_Brush,   cid, variant, dfcombat1_Brush,   startPos)
    addEvent(RunPart, 200, combat2_Brush_2, cid, variant, dfcombat2_Brush_2, startPos)
    addEvent(RunPart, 300, combat3_Brush_2, cid, variant, dfcombat3_Brush_2, startPos)

    return
end
[Warning - CallBack::loadCallBack] Event onRavioliRavioli not found.
[Warning - CallBack::loadCallBack] Event onRavioliRavioli2 not found.
[Warning - Event::checkScript] Event onCastSpell not found. scripts/energyballs.lua
[Warning - CallBack::loadCallBack] Event onRavioliRavioli not found.
[Warning - CallBack::loadCallBack] Event onRavioliRavioli2 not found.
[Warning - Event::checkScript] Event onCastSpell not found. scripts/healing/donatormana.lua
 
give me 2 days, ill convert. i got something to do in about 2 hours so idk if can get it converted in time
Post automatically merged:

actually ill just fix whats done, taking a look at this, i would have to practically rebuild it, sense everything i have tried so far keeps getting more and more errors.
Post automatically merged:

@Lessaire yo after looking at the script i got this far however it says the "originpoint" is undefined and when i try to define it with "getplayerposition" it says "is a boolean value"

here is where i am


LUA:
local function cCA()
    return createCombatArea({
        {0, 1, 0},
        {1, 2, 1},
        {0, 1, 0}
    })
end

local function onRavioliRavioli()
    local level = getPlayerLevel(cid)
    local mlevel = getPlayerMagLevel(cid)
    local player = Player(cid)
    -- what we want
    player:addMana(math.random(5000, 7000))
    -- not really using this
    local min = (level / 5) + (mlevel * 3.2) + 20
    local max = (level / 5) + (mlevel * 5.4) + 40
    return min, max
end
local function onRavioliRavioli2()
    local level = getPlayerLevel(cid)
    local mlevel = getPlayerMagLevel(cid)
    local player = Player(cid)
    -- what we want
    player:addMana(math.random(2000, 3000))
    -- not really using this
    local min = (level / 5) + (mlevel * 3.2) + 20
    local max = (level / 5) + (mlevel) + 40
    return min, max
end


local combat0_Brush   = Combat()
local combat1_Brush   = Combat()
local combat2_Brush_2 = Combat()
local combat3_Brush_2 = Combat()

local dfcombat0_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  1,  0, 0, 1, 0, -1}
local dfcombat1_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  0, -1, 0, 1, 1,  0}
local dfcombat2_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}
local dfcombat3_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}

combat0_Brush:setArea(   cCA())
combat1_Brush:setArea(   cCA())
combat2_Brush_2:setArea( cCA())
combat3_Brush_2:setArea( cCA())

--== Magic Effects? ==--
local function RunPart(brush, caster, target, dirList, originPoint) -- Part
    if (isCreature(caster)) then
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                local targetPoint = {
                    x = originPoint.x-dirList[i],
                    y = originPoint.y-dirList[i+1],
                    z = originPoint.z
                }
                Position(originPoint):sendDistanceEffect(targetPoint, dirList[1])
                i = i + 2
            end       
        end
    end
end


function onCastSpell(cid, variant, isHotkey)

             RunPart(      combat0_Brush,   cid, variant, dfcombat0_Brush,   startPos)
    addEvent(RunPart, 100, combat1_Brush,   cid, variant, dfcombat1_Brush,   startPos)
    addEvent(RunPart, 200, combat2_Brush_2, cid, variant, dfcombat2_Brush_2, startPos)
    addEvent(RunPart, 300, combat3_Brush_2, cid, variant, dfcombat3_Brush_2, startPos)

    return doCombat(caster, brush, target)
end
 
Last edited:
give me 2 days, ill convert. i got something to do in about 2 hours so idk if can get it converted in time
Post automatically merged:

actually ill just fix whats done, taking a look at this, i would have to practically rebuild it, sense everything i have tried so far keeps getting more and more errors.
Post automatically merged:

@Lessaire yo after looking at the script i got this far however it says the "originpoint" is undefined and when i try to define it with "getplayerposition" it says "is a boolean value"

here is where i am


LUA:
local function cCA()
    return createCombatArea({
        {0, 1, 0},
        {1, 2, 1},
        {0, 1, 0}
    })
end

local function onRavioliRavioli()
    local level = getPlayerLevel(cid)
    local mlevel = getPlayerMagLevel(cid)
    local player = Player(cid)
    -- what we want
    player:addMana(math.random(5000, 7000))
    -- not really using this
    local min = (level / 5) + (mlevel * 3.2) + 20
    local max = (level / 5) + (mlevel * 5.4) + 40
    return min, max
end
local function onRavioliRavioli2()
    local level = getPlayerLevel(cid)
    local mlevel = getPlayerMagLevel(cid)
    local player = Player(cid)
    -- what we want
    player:addMana(math.random(2000, 3000))
    -- not really using this
    local min = (level / 5) + (mlevel * 3.2) + 20
    local max = (level / 5) + (mlevel) + 40
    return min, max
end


local combat0_Brush   = Combat()
local combat1_Brush   = Combat()
local combat2_Brush_2 = Combat()
local combat3_Brush_2 = Combat()

local dfcombat0_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  1,  0, 0, 1, 0, -1}
local dfcombat1_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  0, -1, 0, 1, 1,  0}
local dfcombat2_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}
local dfcombat3_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}

combat0_Brush:setArea(   cCA())
combat1_Brush:setArea(   cCA())
combat2_Brush_2:setArea( cCA())
combat3_Brush_2:setArea( cCA())

--== Magic Effects? ==--
local function RunPart(brush, caster, target, dirList, originPoint) -- Part
    if (isCreature(caster)) then
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                local targetPoint = {
                    x = originPoint.x-dirList[i],
                    y = originPoint.y-dirList[i+1],
                    z = originPoint.z
                }
                Position(originPoint):sendDistanceEffect(targetPoint, dirList[1])
                i = i + 2
            end     
        end
    end
end


function onCastSpell(cid, variant, isHotkey)

             RunPart(      combat0_Brush,   cid, variant, dfcombat0_Brush,   startPos)
    addEvent(RunPart, 100, combat1_Brush,   cid, variant, dfcombat1_Brush,   startPos)
    addEvent(RunPart, 200, combat2_Brush_2, cid, variant, dfcombat2_Brush_2, startPos)
    addEvent(RunPart, 300, combat3_Brush_2, cid, variant, dfcombat3_Brush_2, startPos)

    return doCombat(caster, brush, target)
end
Not working , no errors

i just generated this one and replaced on cast function with this one
Code:
function onCastSpell(creature, var)
    local cid = creature:getId()

and also fixed mana problem by adding this
Code:
doPlayerAddMana(cid, 7000)
i need it to say the healed amount or even say the name of rune with orange text



here is the code
Code:
-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{1, 0, 1},
{0, 2, 0},
{1, 0, 1}}))
function getDmg_Brush(cid, level, maglevel)
    return (10)*-1,(20)*-1
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat0_Brush = {CONST_ANI_ICE,1,1,-1,1,-1,-1,1,-1}local combat0_Brush_3 = createCombatObject()
setCombatParam(combat0_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_WATERSPLASH)
setCombatParam(combat0_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_3,createCombatArea({{3}}))
function getDmg_Brush_3(cid, level, maglevel)
    return (10)*-1,(20)*-1
end
setCombatCallback(combat0_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

-- Areas/Combat for 100ms
local combat1_Brush_2 = createCombatObject()
setCombatParam(combat1_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat1_Brush_2,createCombatArea({{1, 0, 1},
{0, 2, 0},
{1, 0, 1}}))
function getDmg_Brush_2(cid, level, maglevel)
    return (10)*-1,(20)*-1
end
setCombatCallback(combat1_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")
local dfcombat1_Brush_2 = {CONST_ANI_SMALLICE,1,1,-1,1,-1,-1,1,-1}local combat1_Brush_3 = createCombatObject()
setCombatParam(combat1_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_WATERSPLASH)
setCombatParam(combat1_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat1_Brush_3,createCombatArea({{3}}))
function getDmg_Brush_3(cid, level, maglevel)
    return (10)*-1,(20)*-1
end
setCombatCallback(combat1_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

-- Areas/Combat for 200ms
local combat2_Brush_2 = createCombatObject()
setCombatParam(combat2_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat2_Brush_2,createCombatArea({{1, 0, 1},
{0, 2, 0},
{1, 0, 1}}))
function getDmg_Brush_2(cid, level, maglevel)
    return (10)*-1,(20)*-1
end
setCombatCallback(combat2_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")
local dfcombat2_Brush_2 = {CONST_ANI_SMALLICE,1,1,-1,1,-1,-1,1,-1}local combat2_Brush_3 = createCombatObject()
setCombatParam(combat2_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_WATERSPLASH)
setCombatParam(combat2_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat2_Brush_3,createCombatArea({{3}}))
function getDmg_Brush_3(cid, level, maglevel)
    return (10)*-1,(20)*-1
end
setCombatCallback(combat2_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
    if (isCreature(cid)) then
        doCombat(cid, c, var)
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
                i = i + 2
            end       
        end
    end
end

function onCastSpell(creature, var)
    local cid = creature:getId()
    local startPos = getCreaturePosition(cid)
    doPlayerAddMana(cid, 7000)
    RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
    RunPart(combat0_Brush_3,cid,var)
    addEvent(RunPart,100,combat1_Brush_2,cid,var,dfcombat1_Brush_2,startPos)
    addEvent(RunPart,100,combat1_Brush_3,cid,var)
    addEvent(RunPart,200,combat2_Brush_2,cid,var,dfcombat2_Brush_2,startPos)
    addEvent(RunPart,200,combat2_Brush_3,cid,var)
    return true
end
 
you will either want to add this to your source

and add

LUA:
local ANIMATION_COLOR = 41 -- What animation color will there be when you heal (Comes over player showing how much mana you healed) 1 - 255 (?)
doSendAnimatedText(manaGain, getPlayerPosition(cid), ANIMATION_COLOR)


or add

LUA:
player:say("7000", TALKTYPE_MONSTER_SAY)

it does not need to beTALKTYPE_MONSTER_SAY as long as its a talktype enum
 
[Warning - CallBack::loadCallBack] Event onRavioliRavioli not found.
[Warning - CallBack::loadCallBack] Event onRavioliRavioli2 not found.
[Warning - Event::checkScript] Event onCastSpell not found. scripts/energyballs.lua
[Warning - CallBack::loadCallBack] Event onRavioliRavioli not found.
[Warning - CallBack::loadCallBack] Event onRavioliRavioli2 not found.
[Warning - Event::checkScript] Event onCastSpell not found. scripts/healing/donatormana.lua

Ok, I take it you are registering this through the spells.xml file? In that case we don't need to create a spell object. It's looking for a raw onCastSpell, because everything is already is created and set when the XML is read.

I'm not sure why it's having a problem with the callbacks. Callbacks just expect a function, their name is irrelevant and can be whatever arbitrary string you want. This script at the bottom of this post should work. I'll get TFS compiled here in a few minutes and test it myself.


and also fixed mana problem by adding this
Code:
doPlayerAddMana(cid, 7000)

In general, when you are refactoring code or writing new code, you want to factor out things that are deprecated, which for this project means the stuff in the compat.lua file. Which contains: function doPlayerAddMana(cid, mana, ...) local p = Player(cid) return p and p:addMana(mana, ...) or false end

Since the spell function already is passed a creature object, I don't think you even need to grab the player. You could simply do: Creature:addMana(7000) but I believe Player(cid):addMana(7000) should also work.

yo after looking at the script i got this far however it says the "originpoint" is undefined and when i try to define it with "getplayerposition" it says "is a boolean value"

originPoint is passed as a parameter when you invoke that function. it was passed through startPos which was defined in the onCastSpell, which you seemed to have stripped out for reasons? local startPos = creature:getPosition()



LUA:
local function cCA()
    return createCombatArea({
        {0, 1, 0},
        {1, 2, 1},
        {0, 1, 0}
    })
end

function onRavioliRavioli(player, level, magicLevel)
    -- what we want
    player:addMana(math.random(5000, 7000))
    -- not really using this
    local min = (level / 5) + (magicLevel * 3.2) + 20
    local max = (level / 5) + (magicLevel * 5.4) + 40
    return min, max
end
function onRavioliRavioli2(player, level, magicLevel)
    -- what we want
    player:addMana(math.random(2000, 3000))
    -- not really using this
    local min = (level / 5) + (magicLevel * 3.2) + 20
    local max = (level / 5) + (magicLevel * 5.4) + 40
    return min, max
end


local combat0_Brush   = Combat()
local combat1_Brush   = Combat()
local combat2_Brush_2 = Combat()
local combat3_Brush_2 = Combat()

local dfcombat0_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  1,  0, 0, 1, 0, -1}
local dfcombat1_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  0, -1, 0, 1, 1,  0}
local dfcombat2_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}
local dfcombat3_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}

combat0_Brush:setArea(   cCA())
combat1_Brush:setArea(   cCA())
combat2_Brush_2:setArea( cCA())
combat3_Brush_2:setArea( cCA())

combat0_Brush:setCallback(  CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli")
combat1_Brush:setCallback(  CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli")
combat2_Brush_2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli2")
combat3_Brush_2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli2")

combat0_Brush:setParameter(  COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat1_Brush:setParameter(  COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat2_Brush_2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat3_Brush_2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)

--== Magic Effects? ==--
local function RunPart(brush, caster, target, dirList, originPoint) -- Part
    if (Creature(caster)) then
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                local targetPoint = {
                    x = originPoint.x-dirList[i],
                    y = originPoint.y-dirList[i+1],
                    z = originPoint.z
                }
                Position(originPoint):sendDistanceEffect(targetPoint, dirList[1])
                i = i + 2
            end   
        end
        return brush:execute(caster, target)
    end
end

function onCastSpell(creature, variant, isHotkey)
    local startPos = creature:getPosition()
    creature:say("Don't forget to give the posts replying to your thread trying to help you thumbs up", TALKTYPE_MONSTER_SAY)



    addEvent(RunPart, 300, combat3_Brush_2, creature, variant, dfcombat3_Brush_2, startPos)
    addEvent(RunPart, 200, combat2_Brush_2, creature, variant, dfcombat2_Brush_2, startPos)
    addEvent(RunPart, 100, combat1_Brush,   creature, variant, dfcombat1_Brush,   startPos)
    return   RunPart(      combat0_Brush,   creature, variant, dfcombat0_Brush,   startPos)
end
 
Last edited:
Solution
[Warning - CallBack::loadCallBack] Event onRavioliRavioli not found.
[Warning - CallBack::loadCallBack] Event onRavioliRavioli2 not found.
[Warning - CallBack::loadCallBack] Event onRavioliRavioli not found.
[Warning - CallBack::loadCallBack] Event onRavioliRavioli2 not found.
 
That is bizarre. I just double checked with grep and there is nothing special about the string "onGetFormulaValues", it's not mentioned in /src at all. There should be nothing different between that code and this for example. The function name shouldn't matter. Where it is in the file shouldn't matter, and even in languages where it does, it just need to be anywhere above the invocation. As long as the function exists and returns two integers, it should work.

😕
 
That is bizarre. I just double checked with grep and there is nothing special about the string "onGetFormulaValues", it's not mentioned in /src at all. There should be nothing different between that code and this for example. The function name shouldn't matter. Where it is in the file shouldn't matter, and even in languages where it does, it just need to be anywhere above the invocation. As long as the function exists and returns two integers, it should work.

😕
what i have noticed at least when working with source, if certain parts of the code dont work, or are not fully defined, even unrelated, it can break other parts.

So it could be that, that is not what is broken, but another part.
 
Ok, I take it you are registering this through the spells.xml file? In that case we don't need to create a spell object. It's looking for a raw onCastSpell, because everything is already is created and set when the XML is read.

I'm not sure why it's having a problem with the callbacks. Callbacks just expect a function, their name is irrelevant and can be whatever arbitrary string you want. This script at the bottom of this post should work. I'll get TFS compiled here in a few minutes and test it myself.




In general, when you are refactoring code or writing new code, you want to factor out things that are deprecated, which for this project means the stuff in the compat.lua file. Which contains: function doPlayerAddMana(cid, mana, ...) local p = Player(cid) return p and p:addMana(mana, ...) or false end

Since the spell function already is passed a creature object, I don't think you even need to grab the player. You could simply do: Creature:addMana(7000) but I believe Player(cid):addMana(7000) should also work.



originPoint is passed as a parameter when you invoke that function. it was passed through startPos which was defined in the onCastSpell, which you seemed to have stripped out for reasons? local startPos = creature:getPosition()



LUA:
local function cCA()
    return createCombatArea({
        {0, 1, 0},
        {1, 2, 1},
        {0, 1, 0}
    })
end

function onRavioliRavioli(player, level, magicLevel)
    -- what we want
    player:addMana(math.random(5000, 7000))
    -- not really using this
    local min = (level / 5) + (magicLevel * 3.2) + 20
    local max = (level / 5) + (magicLevel * 5.4) + 40
    return min, max
end
function onRavioliRavioli2(player, level, magicLevel)
    -- what we want
    player:addMana(math.random(2000, 3000))
    -- not really using this
    local min = (level / 5) + (magicLevel * 3.2) + 20
    local max = (level / 5) + (magicLevel * 5.4) + 40
    return min, max
end


local combat0_Brush   = Combat()
local combat1_Brush   = Combat()
local combat2_Brush_2 = Combat()
local combat3_Brush_2 = Combat()

local dfcombat0_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  1,  0, 0, 1, 0, -1}
local dfcombat1_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  0, -1, 0, 1, 1,  0}
local dfcombat2_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}
local dfcombat3_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}

combat0_Brush:setArea(   cCA())
combat1_Brush:setArea(   cCA())
combat2_Brush_2:setArea( cCA())
combat3_Brush_2:setArea( cCA())

combat0_Brush:setCallback(  CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli")
combat1_Brush:setCallback(  CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli")
combat2_Brush_2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli2")
combat3_Brush_2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli2")

combat0_Brush:setParameter(  COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat1_Brush:setParameter(  COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat2_Brush_2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat3_Brush_2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)

--== Magic Effects? ==--
local function RunPart(brush, caster, target, dirList, originPoint) -- Part
    if (Creature(caster)) then
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                local targetPoint = {
                    x = originPoint.x-dirList[i],
                    y = originPoint.y-dirList[i+1],
                    z = originPoint.z
                }
                Position(originPoint):sendDistanceEffect(targetPoint, dirList[1])
                i = i + 2
            end
        end
        return brush:execute(caster, target)
    end
end

function onCastSpell(creature, variant, isHotkey)
    local startPos = creature:getPosition()
    creature:say("Don't forget to give the posts replying to your thread trying to help you thumbs up", TALKTYPE_MONSTER_SAY)



    addEvent(RunPart, 300, combat3_Brush_2, creature, variant, dfcombat3_Brush_2, startPos)
    addEvent(RunPart, 200, combat2_Brush_2, creature, variant, dfcombat2_Brush_2, startPos)
    addEvent(RunPart, 100, combat1_Brush,   creature, variant, dfcombat1_Brush,   startPos)
    return   RunPart(      combat0_Brush,   creature, variant, dfcombat0_Brush,   startPos)
end
Thanks
It's working with these errors
Code:
Lua Script Error: [Spell Interface]
(Unknown scriptfile)
attempt to call a nil value

Lua Script Error: [Spell Interface]
(Unknown scriptfile)
attempt to call a nil value

Lua Script Error: [Spell Interface]
data/spells/scripts/healing/donatormana.lua:onCastSpell
LuaScriptInterface::luaAddEvent(). Argument #4 is unsafe
stack traceback:
        [C]: in function 'addEvent'
        data/spells/scripts/healing/donatormana.lua:77: in function <data/spells/scripts/healing/donatormana.lua:71>

Lua Script Error: [Spell Interface]
data/spells/scripts/healing/donatormana.lua:onCastSpell
LuaScriptInterface::luaAddEvent(). Argument #4 is unsafe
stack traceback:
        [C]: in function 'addEvent'
        data/spells/scripts/healing/donatormana.lua:78: in function <data/spells/scripts/healing/donatormana.lua:71>

can i combine addMana,addHealth together?
is it possible to say the amount healed without editing source?
 
Last edited:
One second, this should be easy.
Post automatically merged:


I believe this should eliminate the unsafe argument warnings.

The COMBAT_PARAM_TYPE being set to COMBAT_HEALING means this technically already does heal HP. It's just a very low amount since I included basic amounts vestigial from the code example donor. You could modify the local min local max variable formulas to generate much large numbers if you wish. For example (level / 2) + (magicLevel * 10) + 500 and (level * 1.2) + (magicLevel * 12) + 1000

Since the amount healed isn't determined immediately, and happens several times, you'd have to put playerer:say inside the callbacks.

Also, if want to say thanks, use the 👍 in the footer of our posts.

LUA:
local function cCA()
    return createCombatArea({
        {0, 1, 0},
        {1, 2, 1},
        {0, 1, 0}
    })
end

function onRavioliRavioli(player, level, magicLevel)
    local manaAmount = math.random(5000, 7000);
    player:addMana(manaAmount)
    player:say("DONOR RUNE MANA UP " .. manaAmount, TALKTYPE_MONSTER_SAY)
    local min = (level / 5) + (magicLevel * 3.2) + 20
    local max = (level / 5) + (magicLevel * 5.4) + 40
    return min, max
end

function onRavioliRavioli2(player, level, magicLevel)
    local manaAmount = math.random(2000, 3000);
    player:addMana(manaAmount)
    player:say("DONOR RUNE MANA UP " .. manaAmount, TALKTYPE_MONSTER_SAY)
    local min = (level / 5) + (magicLevel * 3.2) + 20
    local max = (level / 5) + (magicLevel * 5.4) + 40
    return min, max
end


local combat0_Brush   = Combat()
local combat1_Brush   = Combat()
local combat2_Brush_2 = Combat()
local combat3_Brush_2 = Combat()

local dfcombat0_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  1,  0, 0, 1, 0, -1}
local dfcombat1_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  0, -1, 0, 1, 1,  0}
local dfcombat2_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}
local dfcombat3_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}

combat0_Brush:setArea(   cCA())
combat1_Brush:setArea(   cCA())
combat2_Brush_2:setArea( cCA())
combat3_Brush_2:setArea( cCA())

combat0_Brush:setCallback(  CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli")
combat1_Brush:setCallback(  CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli")
combat2_Brush_2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli2")
combat3_Brush_2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli2")

combat0_Brush:setParameter(  COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat1_Brush:setParameter(  COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat2_Brush_2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat3_Brush_2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)

--== Magic Effects? ==--
local function RunPart(brush, casterId, target, dirList, originPoint) -- Part
    local caster = Creature(casterId)
    if (Creature(caster)) then
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                local targetPoint = {
                    x = originPoint.x-dirList[i],
                    y = originPoint.y-dirList[i+1],
                    z = originPoint.z
                }
                Position(originPoint):sendDistanceEffect(targetPoint, dirList[1])
                i = i + 2
            end  
        end
        return brush:execute(caster, target)
    end
end

function onCastSpell(creature, variant, isHotkey)
    local startPos = creature:getPosition()
    local creatureId = creature:getId()

    addEvent(RunPart, 300, combat3_Brush_2, creatureId, variant, dfcombat3_Brush_2, startPos)
    addEvent(RunPart, 200, combat2_Brush_2, creatureId, variant, dfcombat2_Brush_2, startPos)
    addEvent(RunPart, 100, combat1_Brush,   creatureId, variant, dfcombat1_Brush,   startPos)
    return   RunPart(      combat0_Brush,   creatureId, variant, dfcombat0_Brush,   startPos)
end
 
Last edited:
One second, this should be easy.
Post automatically merged:


I believe this should eliminate the unsafe argument warnings.

The COMBAT_PARAM_TYPE being set to COMBAT_HEALING means this technically already does heal HP. It's just a very low amount since I included basic amounts vestigial from the code example donor. You could modify the local min local max variable formulas to generate much large numbers if you wish. For example (level / 2) + (magicLevel * 10) + 500 and (level * 1.2) + (magicLevel * 12) + 1000

Since the amount healed isn't determined immediately, and happens several times, you'd have to put playerer:say inside the callbacks.

Also, if want to say thanks, use the 👍 in the footer of our posts.

LUA:
local function cCA()
    return createCombatArea({
        {0, 1, 0},
        {1, 2, 1},
        {0, 1, 0}
    })
end

function onRavioliRavioli(player, level, magicLevel)
    local manaAmount = math.random(5000, 7000);
    player:addMana(manaAmount)
    player:say("DONOR RUNE MANA UP " .. manaAmount, TALKTYPE_MONSTER_SAY)
    local min = (level / 5) + (magicLevel * 3.2) + 20
    local max = (level / 5) + (magicLevel * 5.4) + 40
    return min, max
end

function onRavioliRavioli2(player, level, magicLevel)
    local manaAmount = math.random(2000, 3000);
    player:addMana(manaAmount)
    player:say("DONOR RUNE MANA UP " .. manaAmount, TALKTYPE_MONSTER_SAY)
    local min = (level / 5) + (magicLevel * 3.2) + 20
    local max = (level / 5) + (magicLevel * 5.4) + 40
    return min, max
end


local combat0_Brush   = Combat()
local combat1_Brush   = Combat()
local combat2_Brush_2 = Combat()
local combat3_Brush_2 = Combat()

local dfcombat0_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  1,  0, 0, 1, 0, -1}
local dfcombat1_Brush   = {CONST_ANI_ENERGYBALL,-1, 0,  0, -1, 0, 1, 1,  0}
local dfcombat2_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}
local dfcombat3_Brush_2 = {CONST_ANI_SMALLICE,   0, 1, -1,  0, 1, 0, 0, -1}

combat0_Brush:setArea(   cCA())
combat1_Brush:setArea(   cCA())
combat2_Brush_2:setArea( cCA())
combat3_Brush_2:setArea( cCA())

combat0_Brush:setCallback(  CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli")
combat1_Brush:setCallback(  CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli")
combat2_Brush_2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli2")
combat3_Brush_2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onRavioliRavioli2")

combat0_Brush:setParameter(  COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat1_Brush:setParameter(  COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat2_Brush_2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat3_Brush_2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)

--== Magic Effects? ==--
local function RunPart(brush, casterId, target, dirList, originPoint) -- Part
    local caster = Creature(casterId)
    if (Creature(caster)) then
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                local targetPoint = {
                    x = originPoint.x-dirList[i],
                    y = originPoint.y-dirList[i+1],
                    z = originPoint.z
                }
                Position(originPoint):sendDistanceEffect(targetPoint, dirList[1])
                i = i + 2
            end
        end
        return brush:execute(caster, target)
    end
end

function onCastSpell(creature, variant, isHotkey)
    local startPos = creature:getPosition()
    local creatureId = creature:getId()

    addEvent(RunPart, 300, combat3_Brush_2, creatureId, variant, dfcombat3_Brush_2, startPos)
    addEvent(RunPart, 200, combat2_Brush_2, creatureId, variant, dfcombat2_Brush_2, startPos)
    addEvent(RunPart, 100, combat1_Brush,   creatureId, variant, dfcombat1_Brush,   startPos)
    return   RunPart(      combat0_Brush,   creatureId, variant, dfcombat0_Brush,   startPos)
end
Worked , but i get this error
Lua Script Error: [Spell Interface]
(Unknown scriptfile)
attempt to call a nil value

Lua Script Error: [Spell Interface]
(Unknown scriptfile)
attempt to call a nil value
 
Back
Top