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

Add distanceeffect on spell

Lucifer

Active Member
Joined
Dec 27, 2014
Messages
145
Reaction score
33
Location
Sweden
How can i add distanceeffect on this spell?

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 16)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, 22)
combat2:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat2:setParameter(COMBAT_PARAM_USECHARGES, true)
combat2:setArea(createCombatArea(AREA_CIRCLE3X3))

-- callback function for combat
function onGetFormulaValues1(player, level, maglevel)
    local min = (level / 1) + (maglevel * 3) + 32
    local max = (level / 5) + (maglevel * 9) + 40
    return -min, -max
end

-- callback function for combat2
function onGetFormulaValues2(player, level, maglevel)
    local min = (level / 1) + (maglevel * 3) + 32
    local max = (level / 5) + (maglevel * 9) + 40
    return -min, -max
end

-- execute the callback functions after casting the spell for both combat & combat2 respectfully
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues1")
combat2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2")

-- 2 second delay
local delay = 1000 * 2

function onCastSpell(creature, var)
    -- if the spell casts successfully then continue
    if combat:execute(creature, var) then
        -- will execute when the delay time is reached
        addEvent(function(cid, v)
            -- check if the creature exists
            local c = Creature(cid)
            if c then
                -- execute if it does
                combat2:execute(c, v)
            end
            -- parameters the delay time, the creature id (cid) and var (v)
        end, delay, creature:getId(), var)
        -- return true (show the words above the player's head emote or regular text)
        return true
    end
    -- if it doesn't cast successfully then return false and don't show any text
    return false
end

Big love to @Apollos that help me get this spell with 2 attacks
But now i need distanceeffect on this spell to xD
 
Solution
I want to get distance effect on all tiles.
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 16)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, 22)
combat2:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat2:setParameter(COMBAT_PARAM_USECHARGES, true)
combat2:setArea(createCombatArea(AREA_CIRCLE3X3))

function onGetFormulaValues1(player, level, maglevel)
    local min = (level / 1) + (maglevel * 3) + 32
    local max = (level...
I want to get distance effect on all tiles.
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 16)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, 22)
combat2:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat2:setParameter(COMBAT_PARAM_USECHARGES, true)
combat2:setArea(createCombatArea(AREA_CIRCLE3X3))

function onGetFormulaValues1(player, level, maglevel)
    local min = (level / 1) + (maglevel * 3) + 32
    local max = (level / 5) + (maglevel * 9) + 40
    return -min, -max
end

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

function onGetFormulaValues2(player, level, maglevel)
    local min = (level / 1) + (maglevel * 3) + 32
    local max = (level / 5) + (maglevel * 9) + 40
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues1")
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")
combat2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2")

-- 2 second delay
local delay = 1000 * 2

function onCastSpell(creature, var)
    if combat:execute(creature, var) then
        addEvent(function(cid, v)
            local c = Creature(cid)
            if c then
                combat2:execute(c, v)
            end
        end, delay, creature:getId(), var)
        return true
    end
    return false
end
 
Solution
Back
Top