Hello I have spell what is regenerating our health and mana:
I need to add something like this:
- When we have this event on - we startup the event and we are trying to startup next event by casting this spell again (while we actually regenerating our health and mana - event on) - when we cast again spell the event stop and it says - "You have stopped charging".
I have no idea how I can do it.
Anyone can help me ?
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)
doCreatureAddHealth(cid,(getCreatureMaxHealth(cid) * 0.08))
doCreatureAddMana(cid,(getCreatureMaxMana(cid) * 0.08))
doSendMagicEffect(getPlayerPosition(cid), 14)
end
function check1(cid)
if (hasCondition(cid, CONDITION_DRUNK) == TRUE) then
if (hasCondition(cid, CONDITION_INFIGHT) == FALSE) then
if getCreatureHealth(cid) == getCreatureMaxHealth(cid) then
if getCreatureMana(cid) == getCreatureMaxMana(cid) then
mayNotMove(cid, 0)
doRemoveCondition(cid, CONDITION_DRUNK)
doCreatureSetStorage(cid, 6, 0)
doPlayerSendCancel(cid, "Your charge stopped.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
else
addEvent(statup,1000,cid)
addEvent(check1,500,cid)
end
else
addEvent(statup,1000,cid)
addEvent(check1,500,cid)
end
else
mayNotMove(cid, 0)
stopEvent(statup)
stopEvent(check1)
doRemoveCondition(cid, CONDITION_DRUNK)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
else
mayNotMove(cid, 0)
stopEvent(statup)
stopEvent(check1)
doRemoveCondition(cid, CONDITION_DRUNK)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
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)
doCreatureSetStorage(cid, 6, 1)
addEvent(check1,1000,cid)
setPlayerStorageValue(cid,2994,1)
return doCombat(cid, combat, var)
end
else
doPlayerSendCancel(cid, "You cannot start charging power if you are in fight.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end
I need to add something like this:
- When we have this event on - we startup the event and we are trying to startup next event by casting this spell again (while we actually regenerating our health and mana - event on) - when we cast again spell the event stop and it says - "You have stopped charging".
I have no idea how I can do it.
Anyone can help me ?