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

Barrier with on/off + if 0 mana = dispell

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
665
Hello.
I need an Magic Shield script but with on/off option.

Ex.
If i say - utamo vita, i got magic shield, after i got 0 mana my magic shield turn off.
If I have utamo vita ON i can turn it OFF said another time - utamo vita.

Anyone can help me with it ?
 
local storage = 10239 -- epmty storage

local shield = createConditionObject(CONDITION_MANASHIELD)
setConditionParam(shield, CONDITION_PARAM_TICKS, -1)
function onUse(cid, item, frompos, item2, topos)
if getPlayerStorageValue(cid,storage) < 1 then
doAddCondition(cid,shield)
doSendMagicEffect(getThingPos(cid),12)
doPlayerSendTextMessage(cid,27,"Mana Shield : On.")
setPlayerStorageValue(cid,storage,1)
else
doRemoveCondition(cid,CONDITION_MANASHIELD)
doPlayerSendTextMessage(cid,27,"Mana Shield : Off.")
setPlayerStorageValue(cid,storage,-1)
end
return true
end

worked with an item idk if this will work with spell
 
Code:
local shield = createConditionObject(CONDITION_MANASHIELD)
setConditionParam(shield, CONDITION_PARAM_TICKS, -1)

function onCastspell(cid, var)
	if hasCondition(cid, CONDITION_MANASHIELD) [B][COLOR="red"]then[/COLOR][/B]
		doRemoveCondition(cid, CONDITION_MANASHIELD)
	else
		doAddCondition(cid, shield)
	end
	return true
end

For the 0 mana feature you will need some kidn of creaturescript, probably onStatsChange one.
 
Last edited:

Similar threads

Back
Top