• 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 Hoy use combat:clearConditions()

Omin

Strawands.com 10.82
Joined
Aug 12, 2009
Messages
49
Reaction score
7
Location
Barcelona/Spain
How to this used? combat:clearConditions()

Code:
local combat = Combat()
combat:clearConditions() --[[ Is Correct? ]]
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

local condition = Condition(CONDITION_ENERGY)
condition:clearConditions() --[[ Is Correct? ]]
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:addDamage(math.random(8, 10), 10000, -25)
combat:setCondition(condition)

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end
 
Maybe you can try this.
Code:
function onCastSpell(creature, var)
    for i = 0, 27 do
        if creature:getCondition(bit.lshift(1, i), CONDITIONID_DEFAULT) then
            creature:removeCondition(bit.lshift(1, i))
        end
    end
    return combat:execute(creature, var)
end
Sorry I don't know about the rest :(

Edit: you might need to include this in your server to use the bit metatable
http://bitop.luajit.org/download.html

Also check out this for more on bitwise operations
http://lua-users.org/wiki/BitwiseOperators
 
Last edited:
Example spell which affects all online players with a debuff.

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

function onCastSpell(creature, var)
    local players = Game.getPlayers()
    for i = 1, #players do

        local condition = Condition(CONDITION_ENERGY)
        condition:setParameter(CONDITION_PARAM_DELAYED, 1)
        condition:addDamage(math.random(8, 10), 10000, -25)

        -- Clear conditions and set new condition
        -- so that the amount of ticks is random
        -- and not just set once on startup
        combat:clearConditions()
        combat:setCondition(condition)

        combat:execute(creature, Variant(players[i]))
    end

    return combat:execute(creature, var)
end
 
Back
Top