• 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 Small problem with power up.

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
671
Hello
I have small problem with power up spell:
All its working OK but when player got 100% mana the Condition dont remove, mayNotMove dont work and effect it still appear :huh:
Anyone can fix it ?
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
 
Code:
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 
			
if getCreatureMana(cid) == getCreatureMaxMana(cid) then
        mayNotMove(cid, 0)
		stopEvent(statup)
		stopEvent(check1)
        doRemoveCondition(cid, CONDITION_DRUNK)
end

if getCreatureMana(cid) < getCreatureMaxMana(cid) then
  addEvent(statup,1000,cid)
  addEvent(check1,1000,cid)
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
What about this?
 
Last edited:
Back
Top