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

A edited sweaty cyclop doesn't work.

Chaos ruler

New Member
Joined
Dec 1, 2008
Messages
73
Reaction score
0
Location
The Netherlands
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.

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:
Try this

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		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 
                    			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())
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local t, Topic = {[5910]=100, [5911]=100, [5913]=100, [5898]=10, [5941]=1, [5946]=1}, 0

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)
	if npcHandler.focus ~= cid then
		return false
	elseif msgcontains(msg, 'trade') then
		selfSay('I can trade my mask if you want.')
	elseif msgcontains(msg, 'mask') then
		selfSay('Very nice do you want to trade your items for my mask?')
		Topic = 1
	elseif msgcontains(msg, 'yes') and Topic == 1 then
		local v = true
		for id, count in pairs(t) do
			if getPlayerItemCount(cid, id) < count then
				v = false
				break
			end
		end
		if v then
			for id, count in pairs(t) do
				doPlayerRemoveItem(cid, id, count)
			end
			selfSay('Here is your mask.')  
			doPlayerAddItem(cid,3967,1)
		else
			selfSay('Come back when you have more!')
		end
		Topic = 0
	elseif msgcontains(msg, 'no') and Topic == 1 then
		selfSay('Okay then')
		Topic = 0
	end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local t, Topic = {[5910]=100, [5911]=100, [5913]=100, [5898]=10, [5941]=1, [5946]=1}, 0

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)
	if npcHandler.focus ~= cid then
		return false
	elseif msgcontains(msg, 'trade') then
		selfSay('I can trade my mask if you want.')
	elseif msgcontains(msg, 'mask') then
		selfSay('Very nice do you want to trade your items for my mask?')
		Topic = 1
	elseif msgcontains(msg, 'yes') and Topic == 1 then
		local v = true
		for id, count in pairs(t) do
			if getPlayerItemCount(cid, id) < count then
				v = false
				break
			end
		end
		if v then
			for id, count in pairs(t) do
				doRemoveItem(cid, id, count)
			end
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


			selfSay('Here is your mask.')  
doPlayerTakeItem(cid,5946,1)
					doPlayerTakeItem(cid,5913,50)
					doPlayerTakeItem(cid,5910,100)
					doPlayerTakeItem(cid,5911,100)
					doPlayerTakeItem(cid,5898,10)
					doPlayerTakeItem(cid,5941,1)

			doPlayerAddItem(cid,3967,1)
		else
			selfSay('Come back when you have more!')
		end
		Topic = 0
	elseif msgcontains(msg, 'no') and Topic == 1 then
		selfSay('Okay then')
		Topic = 0
	end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Code:
Sweaty Cyclops: Hi n0b l0l
; iten mask plx
Sweaty Cyclops: oki her u g0 n0b give iten
; oki iten her plx

try this
 
Back
Top