Xagul
deathzot.net
- Joined
- Jun 30, 2008
- Messages
- 1,295
- Solutions
- 3
- Reaction score
- 1,043
I am having a small problem, I have a spell that makes you unable to move and when the spell buff is gone it allows you to move again. The problem is when a player dies before it sets their noMove to false it sends an error to the console because it cannot find the creature. I am using this script right now:
I thought maybe I could check to see if the player was found and if not then it would use stopEvent however I cant figure out how stopEvent works xD
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, 10)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, condition)
function onCastSpell(cid, var)
if getCreatureNoMove(cid) == TRUE then
doPlayerSendCancel(cid, "Spell is already active.")
return FALSE
else
doCreatureSetNoMove(cid, TRUE)
addEvent(doCreatureSetNoMove, 5000, cid, FALSE)
doCombat(cid, combat, var)
end
return TRUE
end
I thought maybe I could check to see if the player was found and if not then it would use stopEvent however I cant figure out how stopEvent works xD