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

Looking for an npc that accepts items

Slain

TrueHavoc.com
Joined
Nov 27, 2008
Messages
2,243
Reaction score
31
Could someone possibly make an npc that accepts the item 9020?

example: pay him 10 item id 9020 and he gives you x item.

love, lockjoint
 
here you go:
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

        if msgcontains(msg, 'Item name ') then --Edit the item name
            selfSay('Did you bring me 10 of item name) --Edit the item name also
            talk_state = 1
        

        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            if getPlayerItemCount(cid,9020) >= 10 then
                selfSay('Thanks, here is your reward') --edit this if you want
                    doPlayerAddItem(cid,X,1) --Edit the X for the item you want to give as reward
        end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

let me know if it doesnt work, did it kinda fast.
 
i love you, will test now.\

havent tested yet but can you make it accept 5 different items all for 9020 as the currency instead of one?
 
nice, my bad, kinda tired. Anyways here is this 1. I made it really simple
Code:
-- SIMPLE Quest made by XMarkoX --
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

        if msgcontains(msg, 'quest') then --Edit this if u want
            selfSay('Did you bring me x,x,x,x,x?') --Edit the item names ALL FIVE
            talk_state = 1

        elseif msgcontains(msg, 'yes') and talk_state == 1 then
			doPlayerTakeItem(cid,X,1) --first item id u have to give to npc
			doPlayerTakeItem(cid,X,1) --third item id u have to give to npc
			doPlayerTakeItem(cid,X,1) -- Fourth item id
			doPlayerTakeItem(cid,X,1) -- fifth item id
                selfSay('Thanks, here is your reward') --edit this if you want
                    doPlayerAddItem(cid,X,1) --Edit the X for the item you want to give as reward
        end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
Back
Top