• 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 [0.4] Dispel is not working.

elnelson

Lunaria World Dev
Joined
Jun 20, 2009
Messages
580
Solutions
2
Reaction score
58
Location
México
Hello, otlanders. Im trying to make a spell that "cures" all status, including buffs, haste, burning, etc...
but it is not working at all.

here is the script
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_ATTRIBUTES)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_FREEZING)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_DAZZLED)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_CURSED)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_REGENERATION)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_DRUNK)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_OUTFIT)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_INVISIBLE)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_LIGHT)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_MANASHIELD)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_POISON)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_FIRE)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_ENERGY)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PHYSICAL)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_HASTE)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)


function onCastSpell(cid, var)
   return doCombat(cid, combat, var)
end
 
Solution
yours wouldn't work because you're resetting the same dispel combat parameter and rewriting it over and over again, the final dispel value would only use paralyze
if you want to do this successfully you have to remove all of the conditions
i'd be careful with this though, some of these conditions you might want (CONDITION_ATTRIBUTES for example isn't a curse and probably something you don't want to remove as it's usually a buff)
Lua:
local dispel = {CONDITION_ATTRIBUTES, CONDITION_FREEZING, CONDITION_DAZZLED, CONDITION_CURSED, CONDITION_REGENERATION, CONDITION_DRUNK, CONDITION_OUTFIT, CONDITION_INVISIBLE, CONDITION_LIGHT, CONDITION_MANASHIELD, CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY, CONDITION_PHYSICAL, CONDITION_HASTE...
yours wouldn't work because you're resetting the same dispel combat parameter and rewriting it over and over again, the final dispel value would only use paralyze
if you want to do this successfully you have to remove all of the conditions
i'd be careful with this though, some of these conditions you might want (CONDITION_ATTRIBUTES for example isn't a curse and probably something you don't want to remove as it's usually a buff)
Lua:
local dispel = {CONDITION_ATTRIBUTES, CONDITION_FREEZING, CONDITION_DAZZLED, CONDITION_CURSED, CONDITION_REGENERATION, CONDITION_DRUNK, CONDITION_OUTFIT, CONDITION_INVISIBLE, CONDITION_LIGHT, CONDITION_MANASHIELD, CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY, CONDITION_PHYSICAL, CONDITION_HASTE, CONDITION_PARALYZE}

function onCastSpell(cid, var)
    for _, conditiontype in ipairs(dispel) do
        doRemoveCondition(cid, conditiontype)
    end
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    return true
end
 
Solution
yours wouldn't work because you're resetting the same dispel combat parameter and rewriting it over and over again, the final dispel value would only use paralyze
if you want to do this successfully you have to remove all of the conditions
i'd be careful with this though, some of these conditions you might want (CONDITION_ATTRIBUTES for example isn't a curse and probably something you don't want to remove as it's usually a buff)
Lua:
local dispel = {CONDITION_ATTRIBUTES, CONDITION_FREEZING, CONDITION_DAZZLED, CONDITION_CURSED, CONDITION_REGENERATION, CONDITION_DRUNK, CONDITION_OUTFIT, CONDITION_INVISIBLE, CONDITION_LIGHT, CONDITION_MANASHIELD, CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY, CONDITION_PHYSICAL, CONDITION_HASTE, CONDITION_PARALYZE}

function onCastSpell(cid, var)
    for _, conditiontype in ipairs(dispel) do
        doRemoveCondition(cid, conditiontype)
    end
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    return true
end
excellent, you've done it! thank you veyr much, sir.
 
Back
Top