Chaos ruler
New Member
Hey i tried to edit a sweaty cyclop npc.. Though it didn't went very well. I summon the npc and say hi.. Then i say Mask And Then it crashes? Tibia (8.10)
Do you guys see the bug well.. I don't.
Do you guys see the bug well.. I don't.
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- 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 onThink() npcHandler:onThink() end
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
-- use the real conversation? (true/false)
real = true
if real == true then
tradeMsg = 'I can trade my mask if you want.'
MaskMsg = 'Very nice do you want to trade your items for my mask?'
hasNoMsg = 'Come back when you have more!'
noMsg = 'Ok than.'
end
if msgcontains(msg, 'trade') then
selfSay(tradeMsg)
elseif msgcontains(msg, 'mask') then
selfSay(maskMsg)
talk_state = 1
------------------------------------------------ confirm yes ------------------------------------------------
talk_state = 0
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getPlayerItemCount(cid,5910) >= 100 and
getPlayerItemCount(cid,5911) >= 100 and
getPlayerItemCount(cid,5913) >= 100 and
getPlayerItemCount(cid,5898) >= 10 and
getPlayerItemCount(cid,5941) >= 1 and
getPlayerItemCount(cid,5946) >= 1
then
if doPlayerTakeItem(cid,5946,1) == 0 and
doPlayerTakeItem(cid,5913,50) == 0 and
doPlayerTakeItem(cid,5910,100) == 0 and
doPlayerTakeItem(cid,5911,100) == 0 and
doPlayerTakeItem(cid,5898,10) == 0 and
doPlayerTakeItem(cid,5941,1) == 0
then selfSay('Here is your mask.')
doPlayerAddItem(cid,3967,1)
end
else
selfSay(hasNoMsg)
end
---------------------------------------- confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay(noMsg)
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Last edited: