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

Help with a rune

Lakus

New Member
Joined
May 9, 2009
Messages
27
Reaction score
0
Hello, i have some problems with this rune. I just want to dispeal 2 conditions at once use.


Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_FIRE)


function onCastSpell(creature, var, isHotkey)
    return combat:execute(creature, var)
end


local combat1 = Combat()
combat1:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat1:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat1:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)


function onCastSpell(creature, var, isHotkey)
    return combat1:execute(creature, var)
end

What do you think?
 
Code:
creature:removeCondition(conditionType[, conditionId = CONDITIONID_COMBAT[, subId = 0[, force = false]]])

if you insist on using combats

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_FIRE)

local combat1 = Combat()
combat1:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat1:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat1:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)


function onCastSpell(creature, var, isHotkey)
    return combat:execute(creature, var), combat1:execute(creature, var)
end
 
Thank you! It works perfectly for 2 conditions, jajaj but when i add another condition, CONDITION_ENERGY
Just 2 of them works..
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_FIRE)

local combat1 = Combat()
combat1:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat1:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat1:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)

local combat2 = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_FIRE)

function onCastSpell(creature, var, isHotkey)
return combat:execute(creature, var), combat1:execute(creature, var), combat2:execute(creature, var)
end

There is no error in the console, with 2 works, but with 3, the dispel poison doesnt work.
 
Thank you! It works perfectly for 2 conditions, jajaj but when i add another condition, CONDITION_ENERGY
Just 2 of them works..


There is no error in the console, with 2 works, but with 3, the dispel poison doesnt work.
Code:
local spell = {
    {damageType = COMBAT_HEALING, effect = CONST_ME_MAGIC_GREEN, delay = 100, damage = {300, 500}, arr = {
            {0, 0, 0, 1, 0, 0, 0},
            {0, 0, 1, 3, 1, 0, 0},
            {0, 0, 0, 1, 0, 0, 0}
        }
    },
}

local combats = {}
for i = 1, #spell do
    local callback = string.format('onGetFormulaValues %d', i)
    local v = spell[i]
    combats[i] = Combat()
    combats[i]:setParameter(COMBAT_PARAM_TYPE, v.damageType)
    combats[i]:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
    combats[i]:setParameter(COMBAT_PARAM_EFFECT, v.effect)
    _G[callback] = function() return v.damage[1], v.damage[2] end
    combats[i]:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, callback)
    combats[i]:setArea(createCombatArea(v.arr))
end

local function runSpell(cid, var, n, max)
    if n <= max then
        local delay = spell[n].delay
        addEvent(function(cid, var)
                    local creature = Creature(cid)
                    combats[n]:execute(creature, var)
                    addEvent(runSpell, 0, cid, var, n+1, max)
                end, delay, cid, var)
    end
end

function onCastSpell(creature, var)
    return runSpell(creature:getId(), var, 1, #combats)
end
play around with the parameters and set them to your liking
this is what i use for my spells
you can create multiple combats through the table at the top, you just have to assign the elements you want
make sure the element you want is being assigned as a parameter.
for example effect is:
Code:
combats:setParameter[i](COMBAT_PARAM_EFFECT, v.effect)
 
haha, i think that i dont have the enough scripting level to play correctly with that script, but thanks anyway
 
Finally, i found this script

local conditions = {
CONDITION_POISON,
-- add more conditions
}

local combat = {}

for i = 1, #conditions do
combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_DISPEL, conditions)
end

function dispel(creature, var)
for x = 1, #conditions do
combat[x]:execute(creature, var)
end
return true
end

function onCastSpell(creature, var)
return dispel(creature, var)
end


It works perfectly

https://otland.net/threads/cure-all.242398/
 
Back
Top