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

Lua 7.6 Avesta | Npc trading item for an item

Insane329

New Member
Joined
Jun 24, 2014
Messages
84
Reaction score
0
Hiho. I have no idea, is this can be done this way, but i simply want that my NPC trades a small axe for a pick. I was thinking about just changing the price to the "pick's id", but it doesnt work at all.

Here are my scripts. If someone would be that nice and help, it would be awesome:

Code:
<?xml version="1.0"?>
<npc name="Al Dee" script="rookeq.lua" access="3" lookdir="2" autowalk="25">
<mana now="800" max="800" />
<health now="200" max="200" />
<look type="129" head="100" body="103" legs="53" feet="123" addons="0"/>
<parameters>

    <parameter key="message_greet" value="Hiho! I sell all of the equipments like picks, bows, shovels, ropes, worms, scythes, fishing rods, bags and backpacks." />
    <parameter key="message_farewell" value="Finally." />
    <parameter key="message_placedinqueue" value="I am already talking to one of you creeps. So shut up until it is your turn, |PLAYERNAME|." />
   
   
</parameters>
</npc>

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

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'rope'},2120, 50,'rope')
shopModule:addBuyableItem({'bow'},2456, 1,'bow')
shopModule:addBuyableItem({'fishing rod'},2580, 150,'fishing rod')
shopModule:addBuyableItem({'torch'},2050, 2,'torch')
shopModule:addBuyableItem({'worm'},3976, 1,'worm')
shopModule:addBuyableItem({'scythe'},2550, 12,'scythe')
shopModule:addBuyableItem({'bag'},1987, 4,'bag')
shopModule:addBuyableItem({'backpack'},1988, 10,'backpack')


npcHandler:addModule(FocusModule:new())


When i say hi>pick she should say something like "I can trade a pick for a small axe. Do you have one?" yes/no and here success or fail.

Pick ID: 2553
Small Axe ID: 2559


thank you very much for help
 
Back
Top