hello as title says i rly need help with my npc! iam finished the npc to 60% but i need last script that i cant figure out why it aint working i get some erros on it here take a look and se ip you can se whats wrong and please explain to me cuz i want to learn like where to add what and why wud be rly nice else just post script if u aint got time to learn me some xD thankz in regardz otlanders
Here is the script
Npc.xml
Npc.lua
first error is the Golden cheese lets say the ID is > 1234 <
The npc need to remove this cheese from player and add the player a pair of golden legs ?
Secound error is when i say bye to the npc it dosnt answer and in consolle i get this errors
Here is the script
Npc.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="mmm" script="help.lua" walkinterval="1500" floorchange="0">
<health now="100" max="100"/>
<look type="128 - Citizen Male" head="0" body="0" legs="0" feet="0" addons="0"/>
</npc>
Npc.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local TopicState = {}
-- OTServ event handling functions start
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 onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end
function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
npcHandler:say("Greetings my friend! You look like you're in quite good (health)!", cid)
npcHandler:addFocus(cid)
TopicState[cid] = 0
elseif(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
npcHandler:say("Good bye.", cid, TRUE)
npcHandler:releaseFocus(cid)
elseif msgcontains(msg, "health") then
npcHandler:say("the big ugly anonymus rat lives here it needs to die!", cid)
elseif msgcontains(msg, "rat") then
npcHandler:say("This rat need go be killd go to yalahar levers and find the evil rat and kill it then bring me the golden cheese!", cid)
elseif msgcontains(msg, "golden cheese") then
npcHandler:say("Do you have any golden cheese with you?", cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")
first error is the Golden cheese lets say the ID is > 1234 <
The npc need to remove this cheese from player and add the player a pair of golden legs ?
Secound error is when i say bye to the npc it dosnt answer and in consolle i get this errors
Code:
data/npc/lib/npcsystem/npchandler:647: in function 'say'
data/npc/scripts/help.lua:29: in function 'callback'
data/npc/lib/npcsystem/npchandler:455: in function 'oncreaturesay'