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

mana shield toggle

trosko93

New Member
Joined
May 17, 2020
Messages
16
Reaction score
2
I need some help making a ring right click usable to toggle mana shield on/off, anyone know how?
 
Add this to your data\scripts\actions and change 2167 to your ring ID.
Lua:
local magicShield = Action()

local condition = Condition(CONDITION_MANASHIELD)
condition:setParameter(CONDITION_PARAM_TICKS, -1)

function magicShield.onUse(player, item, fromPos, target, toPos, isHotkey)
    if not player:getCondition(CONDITION_MANASHIELD) then
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
        player:say("Magic Shield [ON]", TALKTYPE_MONSTER_SAY)
        player:addCondition(condition)
    else
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        player:say("Magic Shield [OFF]", TALKTYPE_MONSTER_SAY)
        player:removeCondition(CONDITION_MANASHIELD)
    end
    return true
end
magicShield:id(2167)
magicShield:register()
 
Back
Top