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

RevScripts Loop effect on condition

Icaraii

Well-Known Member
Joined
Jan 5, 2020
Messages
469
Solutions
1
Reaction score
58
Hi guys,

A while ago, @amatria create the script bellow for me, that when the player has mana shield a effect keep on loop. It works just as I needed, but now I want to put a loop on another condition, "condition:setParameter(CONDITION_PARAM_SKILL_SWORDPERCENT, 150)". I'm not sure how to do it, because mana shield and sword percent are very different types of conditions, I will be glad if someone can help.

Lua:
-- time in seconds
local effectInterval = 2
local intervalStorage = 9999

local manaShieldEffect = CreatureEvent("ManaShieldEffect")
manaShieldEffect:type("think")

function manaShieldEffect.onThink(creature, interval)
    local player = Player(creature)

    if not player:hasCondition(CONDITION_MANASHIELD) then -- thats the part I'm having trouble with. Swordpercent is a conditon attribute
        return false
    end

    if os.time() - player:getStorageValue(intervalStorage) < effectInterval then
        return false
    end

    local position = player:getPosition()
    local effectPosition = Position({x = position.x+1, y = position.y+1, z = position.z})
    effectPosition:sendMagicEffect(2)
    player:setStorageValue(intervalStorage, os.time())
    return true
end

manaShieldEffect:register()

local registerEvent = CreatureEvent("RegisterManaShieldEffect")
registerEvent:type("login")

function registerEvent.onLogin(player)
    player:registerEvent("ManaShieldEffect")
    return true
end

registerEvent:register()

link for the original mana shield loop:
 
Back
Top