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

Solved Spell not deal any damage. TFS 1.0

Moj mistrz

Monster Creator
Joined
Feb 1, 2008
Messages
932
Solutions
10
Reaction score
295
Location
Poland
Hiho, spell is only making damage when creature is casting it to the north, other directions do not deal any dmg, just effect appears.
Code:
    arr1 = {
    {2},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1}
    }

    local combat1 = createCombatObject()
    setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    local area1 = createCombatArea(arr1)
    setCombatArea(combat1, area1)

    arr2 = {
    {1, 1, 1, 1, 1, 1, 1, 1, 1, 2}
    }

    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    local area2 = createCombatArea(arr2)
    setCombatArea(combat2, area2)

    arr3 = {
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {1},
    {2}
    }

    local combat3 = createCombatObject()
    setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    local area3 = createCombatArea(arr3)
    setCombatArea(combat3, area3)

    arr4 = {
    {2, 1, 1, 1, 1, 1, 1, 1, 1, 1}
    }

    local combat4 = createCombatObject()
    setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat4, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    local area4 = createCombatArea(arr4)
    setCombatArea(combat4, area4)

local function delayedCastSpell(cid, var)
    local creature = Creature(cid)
    if isCreature(cid) == true then
        if creature:getDirection() == 0 then
            doCombat(cid, combat1, positionToVariant(getCreaturePosition(cid)))
        elseif creature:getDirection() == 1 then
            doCombat(cid, combat2, positionToVariant(getCreaturePosition(cid)))
        elseif creature:getDirection() == 2 then
            doCombat(cid, combat3, positionToVariant(getCreaturePosition(cid)))
        elseif creature:getDirection() == 3 then
            doCombat(cid, combat4, positionToVariant(getCreaturePosition(cid)))
        end
        doCreatureSay(cid, "OMRAFIR BREATHES INFERNAL FIRE", TALKTYPE_ORANGE_2)
    end
end

function onCastSpell(cid, var)
    doCreatureSay(cid, "OMRAFIR INHALES DEEPLY!", TALKTYPE_ORANGE_2)
    addEvent(delayedCastSpell, 4000, cid, var)
    return true
end
Making any changes here dont work, but I post it if someones want to know how its configured in spells.xml
Code:
<instant name="omrafir beam" words="#omrafirbeam" aggressive="1" blockwalls="1" needlearn="1" script="monster/omrafirbeam.lua"/>
 
function onGetFormulaValues(cid, skill, attack, factor)
local skillTotal, levelTotal = skill * attack, getPlayerLevel(cid) / 5
return -(((skillTotal * 0.06) + 13) + (levelTotal)), -(((skillTotal * 0.14) + 34) + (levelTotal))
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


Use something like this ^
You are forgetting to set the damage values for each combat.
 
function onGetFormulaValues(cid, skill, attack, factor)
local skillTotal, levelTotal = skill * attack, getPlayerLevel(cid) / 5
return -(((skillTotal * 0.06) + 13) + (levelTotal)), -(((skillTotal * 0.14) + 34) + (levelTotal))
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


Use something like this ^
You are forgetting to set the damage values for each combat.
Yep, but it doesn't matter when the monster uses this spell and has set min/max dmg per use.
As you can see I wrote that spell can deal damage but only when the caster direction is to the north.
 
Oh sorry, I did not see any errors so I assumed you meant what I posted. Honestly I am not sure what is wrong, I would have to study and test it.
 
You are going about it all the wrong way man.... The reason it doesn't work is your area's, and actually I never seen any damage formula in your spell so how it does any damage at all is above me but here is great energy beam, all you have to do is alter this spell for fire and add a delay and you got a working version of the spell you were trying to make, then ofc all you have to do is alter the formula to determine how much the damage is going to be....
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)

local area = createCombatArea(AREA_BEAM7, AREADIAGONAL_BEAM7)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, maglevel)
    min = -((level / 5) + (maglevel * 3.6) + 22)
    max = -((level / 5) + (maglevel * 6) + 37)
    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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

And make sure to put direction="1" for the spell in spells.xml
 
Back
Top