Hello
I have small problem with power up spell:
When player got 100% mana the condition removing and maynotmove(cid, 0).
Here its my spell:
I have small problem with power up spell:
Anyone can fix it ?All its working OK but when player got 100% mana the Condition dont remove, mayNotMove dont work and effect it still appear :huh:
When player got 100% mana the condition removing and maynotmove(cid, 0).
Here its my spell:
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS, 24*60*1000)
function statup(cid)
doCreatureAddMana(cid,(getPlayerLevel(cid)*math.random(1,10)))
doSendMagicEffect(getPlayerPosition(cid), 1)
end
function check1(cid)
if (hasCondition(cid, CONDITION_DRUNK) == TRUE) then
if (hasCondition(cid, CONDITION_INFIGHT) == FALSE) then
if getCreatureMana(cid) < getCreatureMaxMana(cid) then
if getCreatureMana(cid) == getCreatureMaxMana(cid) then
mayNotMove(cid, 0)
doRemoveCondition(cid, CONDITION_DRUNK)
else
addEvent(statup,1000,cid)
addEvent(check1,1000,cid)
end
else
addEvent(statup,1000,cid)
addEvent(check1,1000,cid)
end
else
mayNotMove(cid, 0)
stopEvent(statup)
stopEvent(check1)
doRemoveCondition(cid, CONDITION_DRUNK)
end
else
mayNotMove(cid, 0)
stopEvent(statup)
stopEvent(check1)
doRemoveCondition(cid, CONDITION_DRUNK)
end
end
function onCastSpell(cid, var)
if(hasCondition(cid, CONDITION_INFIGHT) == FALSE) then
if(hasCondition(cid, CONDITION_DRUNK) == FALSE) then
doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)
mayNotMove(cid, 1)
addEvent(check1,1000,cid)
return doCombat(cid, combat, var)
end
else
doPlayerSendCancel(cid, "You cannot start charging mana if you are infight.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end