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

[Request] Problem with Spell ;/.

Renusek

beton beton beton punk!
Joined
Jul 24, 2008
Messages
1,047
Reaction score
9
Location
Poland - Katowice/Ruda Śląska
Hi. I have problem with spell.. It's not working for me(tfs 0.2 23 patch)
Code:
local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS, 24*60*1000)

function statup(cid)
local ppos = getPlayerPosition(cid) 
doCreatureAddHealth(cid,(getPlayerLevel(cid) * math.random(1,3)))
doPlayerAddMana(cid,(getPlayerLevel(cid) * math.random(1,3)))
doSendMagicEffect(ppos,26)
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 getPlayerMana(cid) == getPlayerMaxMana(cid) then
                  mayNotMove(cid, 0)
                  doRemoveCondition(cid, 11) 
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, 11) 
end
else
  mayNotMove(cid, 0)
  stopEvent(statup)
  stopEvent(check1)
  doRemoveCondition(cid, 11) 
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) 
         end
    end
end

This spell give me hp and mp, I can't move and I can't be in fight. Errors in console when I say 'power up':
Code:
[03/02/2009  23:55:03] Lua Script Error: [Spell Interface] 
[03/02/2009  23:55:03] data/spells/scripts/custom/power up.lua:onCastSpell

[03/02/2009  23:55:03] data/spells/scripts/custom/power up.lua:41: attempt to call global 'hasCondition' (a nil value)
[03/02/2009  23:55:03] stack traceback:
[03/02/2009  23:55:03] 	data/spells/scripts/custom/power up.lua:41: in function <data/spells/scripts/custom/power up.lua:40>
Help plax?
 
I'm not sure but I think

PHP:
if (hasCondition(cid, CONDITION_DRUNK) == TRUE) then

does have to look like this

PHP:
if hasCondition(cid, CONDITION_DRUNK) == TRUE then
 
Back
Top