• 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 Double casting ue

Taqers

New Member
Joined
Mar 18, 2021
Messages
35
Reaction score
1
Location
Germany
GitHub
Taqers
Hello :)

Hoping to find some scripter that might help me.

I am trying to edit the spell exevo gran mas flam so it hits double (0.5 sec later)

The second hit should have other look, for example CONST_ME_ENERGY

Anyone knows the solution?

Here the actual script

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 10)
    local max = (level / 5) + (maglevel * 14)
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local spell = Spell("instant")

function spell.onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

spell:group("attack", "focus")
spell:id(24)
spell:name("Hell's Core")
spell:words("exevo gran mas flam")
spell:level(60)
spell:mana(1100)
spell:isSelfTarget(true)
spell:isPremium(true)
spell:cooldown(40 * 1000)
spell:groupCooldown(4 * 1000, 40 * 1000)
spell:needLearn(false)
spell:vocation("sorcerer;true", "master sorcerer;true")
spell:register()
 
Solution
Hello :)

Hoping to find some scripter that might help me.

I am trying to edit the spell exevo gran mas flam so it hits double (0.5 sec later)

The second hit should have other look, for example CONST_ME_ENERGY

Anyone knows the solution?

Here the actual script

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 10)
    local max = (level / 5) + (maglevel * 14)
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local spell = Spell("instant")...
Hello :)

Hoping to find some scripter that might help me.

I am trying to edit the spell exevo gran mas flam so it hits double (0.5 sec later)

The second hit should have other look, for example CONST_ME_ENERGY

Anyone knows the solution?

Here the actual script

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 10)
    local max = (level / 5) + (maglevel * 14)
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local spell = Spell("instant")

function spell.onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

spell:group("attack", "focus")
spell:id(24)
spell:name("Hell's Core")
spell:words("exevo gran mas flam")
spell:level(60)
spell:mana(1100)
spell:isSelfTarget(true)
spell:isPremium(true)
spell:cooldown(40 * 1000)
spell:groupCooldown(4 * 1000, 40 * 1000)
spell:needLearn(false)
spell:vocation("sorcerer;true", "master sorcerer;true")
spell:register()
Lua:
function spell.onCastSpell(creature, variant)
    if combat:execute(creature, variant) then
        addEvent(function(creatureId)
            local creature = Creature(creatureId)
            if creature then
                combat:execute(creature, Variant(creature:getPosition()))
            end
        end, 500, creature:getId())
        return true
    end
    return false
end
 
Solution
Lua:
local combat1 = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

local combat2 = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_RED)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 10)
    local max = (level / 5) + (maglevel * 14)
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local spell = Spell("instant")

function spell.onCastSpell(creature, variant)
    if combat:execute(creature, variant) then
        addEvent(function(creatureId)
            local creature = Creature(creatureId)
            if creature then
                combat:execute(creature, Variant(creature:getPosition()))
            end
        end, 500, creature:getId())
        return true
    end
    return false
end

spell:group("attack", "focus")
spell:id(24)
spell:name("Hell's Core")
spell:words("exevo gran mas flam")
spell:level(60)
spell:mana(1100)
spell:isSelfTarget(true)
spell:isPremium(true)
spell:cooldown(40 * 1000)
spell:groupCooldown(4 * 1000, 40 * 1000)
spell:needLearn(false)
spell:vocation("sorcerer;true", "master sorcerer;true")
spell:register()
If i put it like that there is an error, can you explain it to me like to a 4 year old? thanks im new to this
 
you can use 2 combats, or change it before using it
Lua:
function spell.onCastSpell(creature, variant)
    combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    if combat:execute(creature, variant) then
        addEvent(function(creatureId)
            local creature = Creature(creatureId)
            if creature then
                combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ASSASSIN)
                combat:execute(creature, Variant(creature:getPosition()))
            end
        end, 500, creature:getId())
        return true
    end
    return false
end
 
Lua:
local combat1 = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

local combat2 = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_RED)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 10)
    local max = (level / 5) + (maglevel * 14)
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local spell = Spell("instant")

function spell.onCastSpell(creature, variant)
    if combat:execute(creature, variant) then
        addEvent(function(creatureId)
            local creature = Creature(creatureId)
            if creature then
                combat:execute(creature, Variant(creature:getPosition()))
            end
        end, 500, creature:getId())
        return true
    end
    return false
end

spell:group("attack", "focus")
spell:id(24)
spell:name("Hell's Core")
spell:words("exevo gran mas flam")
spell:level(60)
spell:mana(1100)
spell:isSelfTarget(true)
spell:isPremium(true)
spell:cooldown(40 * 1000)
spell:groupCooldown(4 * 1000, 40 * 1000)
spell:needLearn(false)
spell:vocation("sorcerer;true", "master sorcerer;true")
spell:register()
If i put it like that there is an error, can you explain it to me like to a 4 year old? thanks im new to this
In your onCast
you need to make it go to the new combat you've named
if combat:execute(creature, variant) then -- old
if combat1:execute(creature, variant) then -- new

you also need to update all of the lines for combat, or it won't work
Lua:
local combat1 = Combat()                               -- was changed
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) -- was missing
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA) -- was missing
combat:setArea(createCombatArea(AREA_CIRCLE5X5))           -- was missing

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 10)
    local max = (level / 5) + (maglevel * 14)
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -- was missing


Also you'd want to copy the whole combat, or you'd get other errors as well.
In the end it would look like this
Lua:
local combat1 = Combat()
combat1:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat1:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat1:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 10)
    local max = (level / 5) + (maglevel * 14)
    return -min, -max
end

combat1:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")


local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat2:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 10)
    local max = (level / 5) + (maglevel * 14)
    return -min, -max
end

combat2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")


local spell = Spell("instant")

function spell.onCastSpell(creature, variant)
    if combat1:execute(creature, variant) then -- combat 1
        addEvent(function(creatureId)
            local creature = Creature(creatureId)
            if creature then
                combat2:execute(creature, Variant(creature:getPosition())) -- combat 2
            end
        end, 500, creature:getId())
        return true
    end
    return false
end

spell:group("attack", "focus")
spell:id(24)
spell:name("Hell's Core")
spell:words("exevo gran mas flam")
spell:level(60)
spell:mana(1100)
spell:isSelfTarget(true)
spell:isPremium(true)
spell:cooldown(40 * 1000)
spell:groupCooldown(4 * 1000, 40 * 1000)
spell:needLearn(false)
spell:vocation("sorcerer;true", "master sorcerer;true")
spell:register()
you can use 2 combats, or change it before using it
Lua:
function spell.onCastSpell(creature, variant)
    combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    if combat:execute(creature, variant) then
        addEvent(function(creatureId)
            local creature = Creature(creatureId)
            if creature then
                combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ASSASSIN)
                combat:execute(creature, Variant(creature:getPosition()))
            end
        end, 500, creature:getId())
        return true
    end
    return false
end
huh.

I thought I've tried that before but wasn't able to change anything..
memory might be mis-remembering and you're just not able to make the initial combat, but can edit the rest?

Cool if it works tho. :)
 
Thanks, working fine. Is there a possibility to add an extra event like

If magic level 135 hit extra cast?
Of course.

Wrap the addEvent with an if statement

Lua:
function spell.onCastSpell(creature, variant)
    if combat1:execute(creature, variant) then
        if player:getMagicLevel() >= 135 then -- if statement starts
            addEvent(function(creatureId)
                local creature = Creature(creatureId)
                if creature then
                    combat2:execute(creature, Variant(creature:getPosition()))
                end
            end, 500, creature:getId())
            return true
        end -- if statement end.
    end
    return false
end
 
Thanks, working fine. Is there a possibility to add an extra event like

If magic level 135 hit extra cast?
Lua:
local combatsByMgLvl = 135

local function extraCombat(creatureId)
    local creature = Creature(creatureId)
    if creature then
        combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ASSASSIN)
        combat:execute(creature, Variant(creature:getPosition()))
    end
end

local spell = Spell("instant")

function spell.onCastSpell(creature, variant)
    combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    if combat:execute(creature, variant) then
        local combatCounts = math.floor(creature:getMagicLevel() / combatsByMgLvl) + 1
        local creatureId = creature:getId()
        for i = 1, combatCounts do
            addEvent(extraCombat, 500 * i, creatureId)
        end
        return true
    end
    return false
end
So every 135 magic level increases 1 extra combat.
the double attack is still maintained, but every time you have 135+ you gain an extra attack, this means that if you have a magic level of 270, you get 2 extra attacks + 1 by default, that would be 3 in total...
 
Of course.

Wrap the addEvent with an if statement

Lua:
function spell.onCastSpell(creature, variant)
    if combat1:execute(creature, variant) then
        if player:getMagicLevel() >= 135 then -- if statement starts
            addEvent(function(creatureId)
                local creature = Creature(creatureId)
                if creature then
                    combat2:execute(creature, Variant(creature:getPosition()))
                end
            end, 500, creature:getId())
            return true
        end -- if statement end.
    end
    return false
end
Somehow it's not working, and its even denying the second ue.

My char 136 mlvl, there are no errors
sorry.

Lua:
if player:getMagicLevel() >= 135 then -- if statement starts
should be
Lua:
if creature:getMagicLevel() >= 135 then -- if statement starts
 
Back
Top