• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

npc janita help

Nacke

New Member
Joined
Feb 13, 2008
Messages
79
Reaction score
0
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)			npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)		npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg)		npcHandler:onCreatureSay(cid, type, msg)		end
function onThink()				npcHandler:onThink()					end

function creatureSayCallback(cid, type, msg) 
origmsg = msg 
msg = string.lower(msg) 
         if msgcontains(msg, 'heal') then
                  local healed = FALSE
                  if getCreatureHealth(cid) < 65 then
                           doCreatureAddHealth(cid,65-getCreatureHealth(cid))
                           doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
                           healed = TRUE    
                  end
                  if hasCondition(cid, CONDITION_POISON) then
                           doRemoveCondition(cid, CONDITION_POISON)
                           doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_RED) 
                           healed = TRUE                  
                  end
                  if healed == TRUE then
                           npcHandler:say("Let me heal your wounds!", cid) 
                  else
                           npcHandler:say("You aren't looking so bad.", cid)
                  end
         end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
PHP:
data/npc/scripts/healer.lua:20: attempt to call global 'hasCondition' (a nil value)
stack traceback:

data/npc/scripts/healer.lua:20: in function 'callback'
data/npc/lib/npcsystem/npchandler.lua:374: in function 'onCreatureSay'
data/npc/scripts/healer.lua:7: in function <data/npc/scripts/healer.lua:7>
please one solution thz.in use tfs 0.2
 
Your ot doesnt has the function hasCondition, and you need update your npc lib (look for lib folder inside npc folder)

Correct me if im worng.

GoodLook!
DX~
 
Just download the newest The Forgotten Server, and replace your folder /data/npc/lib with folder from the newest TFS ^^,
 
Back
Top