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

spellcreator spell to tfs 1.3 formula damage

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
Hello guys, i need your help plz, i made a spell (actually many spells) in spellcreator, and they work great for me when i add local cid = creature:getId()
I use tfs 1.3...and these spells are really old, idk what tfs, maybe 0.4?
well, what i need is to be able to add this:

Lua:
function onGetFormulaValues(player, level, maglevel)
    local level = player:getLevel()
    local min = 400+maglevel*30.8 + level*4.2
    local max = 700+maglevel*35.1 + level*4.4
    return -min, -max
end

into here:

Lua:
-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat0_Brush, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat0_Brush, COMBAT_PARAM_BLOCKSHIELD, true)
setCombatArea(combat0_Brush,createCombatArea({{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0},
{0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0},
{1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1},
{0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0},
{0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}}))
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_FIRE,0,0,1,-1,2,-2,-1,1,-2,2,-3,3,1,1,2,2,3,3,-1,-1,-2,-2,-3,-3,3,-3,4,1,4,-1,-4,1,-4,-1,0,5,0,-5,5,0,-5,0,3,-1,2,-1,3,1,2,1,1,3,1,2,-1,3,-1,2,-2,1,-3,1,-3,-1,-2,-1,-1,-2,-1,-3,1,-2,1,-3}local combat0_Brush_2 = createCombatObject()
setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONHIT)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatArea(combat0_Brush_2,createCombatArea({{0, 0, 0, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{0, 0, 0, 0, 1, 0, 0, 0, 0},
{1, 1, 1, 1, 2, 1, 1, 1, 1},
{0, 0, 0, 0, 1, 0, 0, 0, 0},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 0, 0, 0}}))
function getDmg_Brush_2(cid, level, maglevel)
    return (10)*-1,(20)*-1
end
setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")
local dfcombat0_Brush_2 = {CONST_ANI_FIRE,1,0,2,0,3,0,-1,0,-2,0,-3,0,-4,0,4,0,0,-1,0,-2,0,-3,0,-4,0,1,0,2,0,3,0,4,3,2,2,3,1,4,-1,4,-2,3,-3,2,-1,-4,1,-4,2,-3,3,-2,-2,-3,-3,-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(creature, var)
local cid = creature:getId()
    local startPos = getCreaturePosition(cid)
    RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
    RunPart(combat0_Brush_2,cid,var,dfcombat0_Brush_2,startPos)
    return true
end

Is it possible?? i would be really gratefull!! thanks guys! D;
 
Hello guys, i need your help plz, i made a spell (actually many spells) in spellcreator, and they work great for me when i add local cid = creature:getId()
I use tfs 1.3...and these spells are really old, idk what tfs, maybe 0.4?
well, what i need is to be able to add this:

Lua:
function onGetFormulaValues(player, level, maglevel)
    local level = player:getLevel()
    local min = 400+maglevel*30.8 + level*4.2
    local max = 700+maglevel*35.1 + level*4.4
    return -min, -max
end

into here:

Lua:
-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat0_Brush, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat0_Brush, COMBAT_PARAM_BLOCKSHIELD, true)
setCombatArea(combat0_Brush,createCombatArea({{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0},
{0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0},
{1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1},
{0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0},
{0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}}))
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_FIRE,0,0,1,-1,2,-2,-1,1,-2,2,-3,3,1,1,2,2,3,3,-1,-1,-2,-2,-3,-3,3,-3,4,1,4,-1,-4,1,-4,-1,0,5,0,-5,5,0,-5,0,3,-1,2,-1,3,1,2,1,1,3,1,2,-1,3,-1,2,-2,1,-3,1,-3,-1,-2,-1,-1,-2,-1,-3,1,-2,1,-3}local combat0_Brush_2 = createCombatObject()
setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONHIT)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatArea(combat0_Brush_2,createCombatArea({{0, 0, 0, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{0, 0, 0, 0, 1, 0, 0, 0, 0},
{1, 1, 1, 1, 2, 1, 1, 1, 1},
{0, 0, 0, 0, 1, 0, 0, 0, 0},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 0, 0, 0}}))
function getDmg_Brush_2(cid, level, maglevel)
    return (10)*-1,(20)*-1
end
setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")
local dfcombat0_Brush_2 = {CONST_ANI_FIRE,1,0,2,0,3,0,-1,0,-2,0,-3,0,-4,0,4,0,0,-1,0,-2,0,-3,0,-4,0,1,0,2,0,3,0,4,3,2,2,3,1,4,-1,4,-2,3,-3,2,-1,-4,1,-4,2,-3,3,-2,-2,-3,-3,-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(creature, var)
local cid = creature:getId()
    local startPos = getCreaturePosition(cid)
    RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
    RunPart(combat0_Brush_2,cid,var,dfcombat0_Brush_2,startPos)
    return true
end

Is it possible?? i would be really gratefull!! thanks guys! D;
Lua:
local combat_one = Combat()
combat_one:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat_one:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat_one:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat_one:setParameter(COMBAT_PARAM_BLOCKSHIELD, true)
combat_one:setArea(createCombatArea({
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0},
{0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0},
{1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1},
{0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0},
{0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}}))

local combat_two = Combat()
combat_two:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat_two:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONHIT)
combat_two:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat_two:setParameter(COMBAT_PARAM_BLOCKSHIELD, true)
combat_two:setArea(createCombatArea({
{0, 0, 0, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{0, 0, 0, 0, 1, 0, 0, 0, 0},
{1, 1, 1, 1, 2, 1, 1, 1, 1},
{0, 0, 0, 0, 1, 0, 0, 0, 0},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 0, 0, 0}}))

function onTargetTile(creature, position)
    creature:getPosition():sendDistanceEffect(position, CONST_ANI_FIRE)
end

function onGetFormulaValues(player, level, maglevel)
    local min = 400 + maglevel * 30.8 + level * 4.2
    local max = 700 + maglevel * 35.1 + level * 4.4
    return -min, -max
end

combat_one:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
combat_one:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onTargetTile(creature, position)
    creature:getPosition():sendDistanceEffect(position, CONST_ANI_FIRE)
end

function onGetFormulaValues(player, level, maglevel)
    local min = 400 + maglevel * 30.8 + level * 4.2
    local max = 700 + maglevel * 35.1 + level * 4.4
    return -min, -max
end

combat_two:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
combat_two:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onCastSpell(creature, variant)
    if combat_one:execute(creature, variant) and combat_two:execute(creature, variant) then
        return true
    end
    return false
end
 
Or you can just swap every time you see

Code:
function getDmg_Brush_2(cid, level, maglevel)
    return (10)*-1,(20)*-1
end

With the damage formula but keeping the brush part.

Code:
function getDmg_Brush_2(player, level, maglevel)
    local level = player:getLevel()
    local min = 400+maglevel*30.8 + level*4.2
    local max = 700+maglevel*35.1 + level*4.4
    return -min, -max
end

Remember to use the correct brush every time.
 
correct me if im wrong, even if you guys already solved this problem. "local level = player:getLevel()" shouldnt be needed cause you already call that in from function, just like maglevel and you dont have a local maglevel
 
correct me if im wrong, even if you guys already solved this problem. "local level = player:getLevel()" shouldnt be needed cause you already call that in from function, just like maglevel and you dont have a local maglevel
You're right.

Or you can just swap every time you see

Code:
function getDmg_Brush_2(cid, level, maglevel)
    return (10)*-1,(20)*-1
end

With the damage formula but keeping the brush part.

Code:
function getDmg_Brush_2(player, level, maglevel)
    local level = player:getLevel()
    local min = 400+maglevel*30.8 + level*4.2
    local max = 700+maglevel*35.1 + level*4.4
    return -min, -max
end

Remember to use the correct brush every time.
This will work but this spell generator is old and inefficient, I can't stand seeing it used. It runs doCombat without using it as condition for returning true or false. So the spell will always return true. That and it's about the ugliest looking code possible.
 
Back
Top