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

OpenTibia SpellCreator: A graphical spell creation enviroment

Hi there. Great tool!
The only problem I have is getting the spells to work without crashing the client.
Iam running a 8.6 client on tfs1.3.
I have done the changes needed to be done in "spells.xml", like changing value to script etc.

Here is what I got. Can someone help me out? :) Thanks

The LUA file:

Lua:
-- SpellCreator generated.

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

-- Areas/Combat for 300ms
local combat3_Brush_2 = createCombatObject()
setCombatParam(combat3_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat3_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat3_Brush_2,createCombatArea({{1, 1, 1},
{1, 2, 1},
{1, 1, 1}}))
function getDmg_Brush_2(cid, level, maglevel)
    return (10)*-1,(20)*-1
end
setCombatCallback(combat3_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")

local con_Bleed__combat3_Brush_2 = createConditionObject(0+CONDITION_BLEEDING)
addDamageCondition(con_Bleed__combat3_Brush_2, 3, 1000, -10)
setCombatCondition(combat3_Brush_2, con_Bleed__combat3_Brush_2)

-- =============== 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(cid, var)
    local startPos = getCreaturePosition(cid)
    RunPart(combat0_Brush,cid,var)
    addEvent(RunPart,300,combat3_Brush_2,cid,var)
    return true
end

The XLM file:

XML:
<instant group="attack" spellid="500" name="test" words="test" lvl="1" maglv="1" mana="1" exhaustion="1000" prem="0" needlearn="0" blockwalls="0" aggressive="1" script="attack/test.lua">
    <vocation id="9"/>
    </instant>

(and yes I have a vocation 9) :D hehe

This is a screenshot of the error message after crash:
(It may be very obvious what the issue is, but right now I cant figure it out)
I have also tried to make very simple spells, but run into the same issue. I have a feeling it has to do with that the SpellCreator is built for earlier version of TFS, and that the code has change abit, and it may be a very simple solution to it.
 

Attachments

  • errormessage_client.jpg
    errormessage_client.jpg
    31.6 KB · Views: 70 · VirusTotal
Last edited:
You’re receiving a warning in your console because the SpellCreator was made for 0.3 and 0.3 passes cid into onCastSpell. 1.3 passes creature userdata into onCastSpell and you’re passing the userdata into an addEvent loop - if the creature userdata becomes nonexistent while this loop attempts to execute, your server will crash.

Replace:
Lua:
function onCastSpell(cid, var)
    local startPos = getCreaturePosition(cid)
    RunPart(combat0_Brush,cid,var)
    addEvent(RunPart,300,combat3_Brush_2,cid,var)
    return true
end

With:
Lua:
function onCastSpell(creature, var)
    local cid = creature:getId()
    RunPart(combat0_Brush,cid,var)
    addEvent(RunPart,300,combat3_Brush_2,cid,var)
    return true
end

Posting from my phone, sorry if my formatting sucks.

Red
 
hi i have a problem
This spell don't work
i need help thanks ~~ tibia 10.99.
Code:
local combat = createCombatObject()

setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)

setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 18)

setCombatParam(combat, COMBAT_PARAM_EFFECT, 1)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, 20, -1, -20, 7, 7, 0.75, 20, -25, -30)
 
function onCastSpell(creature, var)
    local cid = creature:getId()
    RunPart(combat,cid,var)
addEvent(RunPart,200,combat,cid,var)
addEvent(RunPart,400,combat,cid,var)
addEvent(RunPart,600,combat,cid,var)
addEvent(RunPart,800,combat,cid,var)
    return true
end
 
hi i have a problem
This spell don't work
i need help thanks ~~ tibia 10.99.
Code:
local combat = createCombatObject()

setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)

setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 18)

setCombatParam(combat, COMBAT_PARAM_EFFECT, 1)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, 20, -1, -20, 7, 7, 0.75, 20, -25, -30)

function onCastSpell(creature, var)
    local cid = creature:getId()
    RunPart(combat,cid,var)
addEvent(RunPart,200,combat,cid,var)
addEvent(RunPart,400,combat,cid,var)
addEvent(RunPart,600,combat,cid,var)
addEvent(RunPart,800,combat,cid,var)
    return true
end
in tfs showed any error?
 
No, i added to cid (cid.uid) but spell uses it on himself ( character).
Try this

Code:
local combat = createCombatObject()

setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 5)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 5)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, 20, -1, -20, 7, 7, 0.75, 20, -25, -30)

local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
local pos1 = getCreaturePosition(cid)
local newpos1 = {x = pos1.x, y = pos1.y, z = pos1.z}
    if (isCreature(cid)) then
        doCombat(cid, c, var)
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                doSendDistanceShoot(newpos1,{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()
    RunPart(combat,cid,var)
addEvent(RunPart,200,combat,cid,var)
addEvent(RunPart,400,combat,cid,var)
addEvent(RunPart,600,combat,cid,var)
addEvent(RunPart,800,combat,cid,var)
    return true
end
 
Lua:
-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{2},
{1},
{1},
{1},
{1}}))
function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 1.4) + 8
    local max = (level / 5) + (maglevel * 2.2) + 14
    return -min, -max
end
combat0_Brush:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

-- Areas/Combat for 200ms
local combat2_Brush = createCombatObject()
setCombatParam(combat2_Brush, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat2_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat2_Brush,createCombatArea({{2, 0, 0, 0, 0},
{0, 1, 0, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 0, 1, 0},
{0, 0, 0, 0, 1}}))
function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 1.4) + 8
    local max = (level / 5) + (maglevel * 2.2) + 14
    return -min, -max
end
combat2_Brush:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

-- Areas/Combat for 400ms
local combat4_Brush = createCombatObject()
setCombatParam(combat4_Brush, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat4_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat4_Brush,createCombatArea({{2, 1, 1, 1, 1}}))
function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 1.4) + 8
    local max = (level / 5) + (maglevel * 2.2) + 14
    return -min, -max
end
combat4_Brush:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

-- Areas/Combat for 600ms
local combat6_Brush = createCombatObject()
setCombatParam(combat6_Brush, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat6_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat6_Brush,createCombatArea({{0, 0, 0, 0, 1},
{0, 0, 0, 1, 0},
{0, 0, 1, 0, 0},
{0, 1, 0, 0, 0},
{2, 0, 0, 0, 0}}))
function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 1.4) + 8
    local max = (level / 5) + (maglevel * 2.2) + 14
    return -min, -max
end
combat6_Brush:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

-- =============== 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()
    RunPart(combat0_Brush,cid,var)
    addEvent(RunPart,200,combat2_Brush,cid,var)
    addEvent(RunPart,400,combat4_Brush,cid,var)
    addEvent(RunPart,600,combat6_Brush,cid,var)
    return true
end

I did this spell as an attack for a monster, but when attacking it does not do any damage to the players, could you help me?
 
1675799001179.png


program opens, but doesnt show any sprites :(
any ideas ?
 
The first graphical spell creator is here for a beta release.

Using this tool you'll be able to make great spells in less time, while it's even fun to do!

lkS3T.png


Features
- A lot.

Whenever you are done with your spell, you will be able to obtain the XML code and the script of your self-made spell.

LEtef.png


i5A2H.png


Besides that, you're also able to export an animated gif animation of your spell, to put on your website or something!

You can also save and continue on your spell later on if you'd like to.

Support for custom sprites is included as well.

Anyway, enjoy! I'd love to see your results as well and hear feedback :). There's enough room for improvement.

(source code will be released later, after the initial release.)

.NET Framework 3.5 is required,
install this if the application crashes.
Hello, it's a good project, if you no longer plan to use this project, you should publish the source code so that the community can update it for the latest versions :) Greetings, I hope you don't take my comment the wrong way.
 
Hello, it's a good project, if you no longer plan to use this project, you should publish the source code so that the community can update it for the latest versions :) Greetings, I hope you don't take my comment the wrong way.
Latest versions , you mean something 12 or 13x , TFS or Canary ?
It works, just it's needed to do some modifications on the outside script.

For example, only this won't work, you get an error about dirEmitPos for sure:
Lua:
if (dirList ~= nil) then
Because the function says: (c,cid,var,dirList,dirEmitPos)
You need add a check if dirEmitPos ~= nil.

Then as said below , on the RunPart, where the addEvents are added, you need add:

Code:
local cid = creature:getId()

This should fix every spell created and work, tested right now on a 13.21 Canary, 12.91 Tfs.
 
Back
Top