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

Lua [SpelL Without Hit o.o]

Joined
May 23, 2010
Messages
185
Reaction score
23
I having some problems with a spell that doesn't hit o.0 I tested it on Rats, Demons, Dragon Lords, and the spell doesn't hit anyone o.0

What's the problem?

Code:
 local spellConfig = {
    {effect = CONST_ME_EXPLOSIONHIT,
     area = createCombatArea({
        {1, 0, 1},
        {0, 1, 0},
        {0, 1, 0}})
    },
    {effect = CONST_ME_EXPLOSIONHIT,
     area = createCombatArea({
        {0, 1, 0, 0, 0},
        {1, 0, 0, 1, 0},
        {0, 0, 2, 0, 0},
        {0, 0, 1, 0, 1},
        {1, 0, 0, 1, 0}})
    },
    {effect = CONST_ME_EXPLOSIONHIT,
     area = createCombatArea({
        {0, 0, 1, 0, 1},
        {1, 0, 0, 0, 1},
        {0, 0, 2, 1, 0},
        {0, 1, 0, 0, 1},
        {1, 0, 1, 0, 0}})
    },
    {effect = CONST_ME_HITBYFIRE,
     area = createCombatArea({
        {0, 0, 1, 0, 1},
        {1, 0, 0, 0, 1},
        {0, 0, 2, 1, 0},
        {0, 1, 0, 0, 1},
        {1, 0, 1, 0, 0}})
    },
    {effect = CONST_ME_EXPLOSIONHIT,
     area = createCombatArea({
        {0, 0, 1, 0, 1, 0, 0},
        {0, 0, 0, 0, 0, 1, 0},
        {1, 0, 0, 0, 0, 0, 1},
        {0, 0, 1, 2, 1, 0, 0},
        {1, 0, 0, 0, 0, 0, 1},
        {0, 0, 1, 0, 0, 0, 0},
        {0, 0, 1, 0, 1, 0, 0}})
    },
    {effect = CONST_ME_HITBYFIRE,
     area = createCombatArea({
        {0, 0, 1, 0, 1, 0, 0},
        {0, 1, 0, 1, 0, 1, 0},
        {1, 0, 1, 0, 0, 0, 1},
        {0, 0, 0, 2, 1, 0, 0},
        {0, 1, 0, 0, 0, 0, 1},
        {1, 0, 0, 1, 0, 1, 0},
        {0, 0, 1, 0, 1, 0, 0}})
    },
    {effect = CONST_ME_EXPLOSIONHIT,
     area = createCombatArea({
        {0, 0, 1, 0, 1, 0, 0},
        {0, 1, 0, 1, 0, 1, 0},
        {1, 0, 1, 0, 0, 0, 1},
        {0, 0, 0, 2, 1, 0, 0},
        {0, 1, 0, 0, 0, 0, 1},
        {1, 0, 0, 1, 0, 1, 0},
        {0, 0, 1, 0, 1, 0, 0}})
    }
}


local combats = {}
for k, config in ipairs(spellConfig) do
    combats[k] = createCombatObject()
        onTargetTile = function(cid, pos)
            local basePos = getThingPosition(cid)
            local fromPos = {x=basePos.x-6, y=basePos.y-8, z=basePos.z}
            doSendDistanceShoot(fromPos, pos, CONST_ANI_FLAMMINGARROW)
        end
        setCombatCallback(combats[k], CALLBACK_PARAM_TARGETTILE, "onTargetTile")
        setCombatParam(combats[k], COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
        setCombatParam(combats[k], COMBAT_PARAM_EFFECT, config.effect)
        setCombatFormula(combats[k], COMBAT_FORMULA_SKILL, 0, 0, 3.0, 0)
        setCombatArea(combats[k], config.area)
end


local function castingSpellTime(p)
    if(isCreature(p[1]) == TRUE) then
        doCombat(unpack(p))
    end
end

function onCastSpell(cid, var)
    for k, combat in ipairs(combats) do
        addEvent(castingSpellTime, (250*k), {cid, combat, var})
    end
    return true
end
 
Lua:
         setCombatFormula(combats[k], COMBAT_FORMULA_SKILL, 0, 0, 3.0, 0)
to:
Lua:
        setCombatFormula(combats[k], COMBAT_FORMULA_SKILL, 10, 8, 5, 20)

And test with a normal player.
 
Back
Top