Hello.
I have a NPC who buys creature products. The problem is that he can't buy several items at a time.
For example:
If I have 1 minotaur leather in my backpack, I can sell it without any problems.
But if I have more than one I get the message: "You do not have this object."
Can someone please help me?
Here is the npc script:
I have a NPC who buys creature products. The problem is that he can't buy several items at a time.
For example:
If I have 1 minotaur leather in my backpack, I can sell it without any problems.
But if I have more than one I get the message: "You do not have this object."
Can someone please help me?
Here is the npc script:
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
-- Start shop
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
--shop sells player buys
shopModule:addBuyableItem({'Rust Remover'}, 9930, 250, 1)
--player sells shop buys
shopModule:addSellableItem({'Acorn'}, 11213, 10)
shopModule:addSellableItem({'Ancient Stone'}, 10549, 200)
shopModule:addSellableItem({'Antlers'}, 11214, 50)
shopModule:addSellableItem({'Ape Fur'}, 5883, 120)
shopModule:addSellableItem({'Badger Fur'}, 11216, 15)
shopModule:addSellableItem({'Bamboo Stick'}, 12401, 30)
shopModule:addSellableItem({'Banana Sash'}, 12467, 55)
shopModule:addSellableItem({'Bat Wing'}, 5894, 50)
shopModule:addSellableItem({'Battle Stone'}, 12403, 290)
shopModule:addSellableItem({'Bear Paw'}, 5896, 100)
shopModule:addSellableItem({'Behemoth Claw'}, 5930, 2000)
shopModule:addSellableItem({'Beholder Eye'}, 5898, 80)
shopModule:addSellableItem({'Black Hood'}, 10562, 190)
shopModule:addSellableItem({'Black Wool'}, 12404, 300)
shopModule:addSellableItem({'Blood Preservation'}, 12405, 320)
shopModule:addSellableItem({'Bloody Pincers'}, 10550, 100)
shopModule:addSellableItem({'Boggy Dreads'}, 10584, 200)
shopModule:addSellableItem({'Bone Shoulderplate'}, 11321, 150)
shopModule:addSellableItem({'Bony Tail'}, 11194, 210)
shopModule:addSellableItem({'Book of Necromantic Rituals'}, 11237, 180)
shopModule:addSellableItem({'Book of Prayers'}, 10563, 120)
shopModule:addSellableItem({'Brimstone Fangs'}, 12658, 350)
shopModule:addSellableItem({'Brimstone Shell'}, 12659, 210)
shopModule:addSellableItem({'Broken Crossbow'}, 12407, 30)
shopModule:addSellableItem({'Broken Draken Mail'}, 12616, 350)
shopModule:addSellableItem({'Broken Gladiator Shield'}, 10573, 180)
shopModule:addSellableItem({'Broken Halberd'}, 11335, 100)
shopModule:addSellableItem({'Broken Helmet'}, 12409, 20)
shopModule:addSellableItem({'Broken Key Ring'}, 12608, 8000)
shopModule:addSellableItem({'Broken Shamanic Staff'}, 12408, 35)
shopModule:addSellableItem({'Broken Slicer'}, 12617, 120)
shopModule:addSellableItem({'Bunch of Troll Hair'}, 10606, 30)
shopModule:addSellableItem({'Bundle of Cursed Straw'}, 10605, 800)
shopModule:addSellableItem({'Carniphila Seeds'}, 11217, 50)
shopModule:addSellableItem({'Carrion Worm Fang'}, 11192, 35)
shopModule:addSellableItem({'Centipede Leg'}, 11218, 28)
shopModule:addSellableItem({'Chicken Feather'}, 5890, 30)
shopModule:addSellableItem({'Cobra Tongue'}, 10551, 15)
shopModule:addSellableItem({'Colourful Feather'}, 12470, 110)
shopModule:addSellableItem({'Compass'}, 11219, 45)
shopModule:addSellableItem({'Corrupted Flag'}, 11326, 700)
shopModule:addSellableItem({'Crab Pincers'}, 11189, 35)
shopModule:addSellableItem({'Cultish Mask'}, 10555, 280)
shopModule:addSellableItem({'Cultish Robe'}, 10556, 150)
shopModule:addSellableItem({'Cultish Symbol'}, 12411, 500)
shopModule:addSellableItem({'Cursed Shoulder Spikes'}, 11327, 320)
shopModule:addSellableItem({'Cyclops Toe'}, 10574, 55)
shopModule:addSellableItem({'Dark Rosary'}, 11220, 48)
shopModule:addSellableItem({'Demon Dust'}, 6550, 300)
shopModule:addSellableItem({'Demon Horn'}, 5954, 1000)
shopModule:addSellableItem({'Demonic Skeletal Hand'}, 10564, 80)
shopModule:addSellableItem({'Dirty Turban'}, 12412, 120)
shopModule:addSellableItem({'Downy Feather'}, 12640, 20)
shopModule:addSellableItem({'Dragon Claw'}, 10020, 8000)
shopModule:addSellableItem({'Dragon Priest\'s Wandtip'}, 11361, 175)
shopModule:addSellableItem({'Dragon Tail'}, 12413, 100)
shopModule:addSellableItem({'Draken Sulphur'}, 12614, 550)
shopModule:addSellableItem({'Draken Wristbands'}, 12615, 430)
shopModule:addSellableItem({'Elder Beholder Tentacle'}, 11193, 150)
shopModule:addSellableItem({'Elven Astral Observer'}, 12421, 90)
shopModule:addSellableItem({'Elven Scouting Glass'}, 12420, 50)
shopModule:addSellableItem({'Elvish Talisman'}, 10552, 45)
shopModule:addSellableItem({'Essence of a Bad Dream'}, 11223, 360)
shopModule:addSellableItem({'Eye of Corruption'}, 12627, 390)
shopModule:addSellableItem({'ferumbras hat'}, 5903, 50000)
shopModule:addSellableItem({'Fiery Heart'}, 10553, 375)
shopModule:addSellableItem({'Fish Fin'}, 5895, 150)
shopModule:addSellableItem({'Flask of Embalming Fluid'}, 12422, 30)
shopModule:addSellableItem({'Frost Giant Pelt'}, 10575, 160)
shopModule:addSellableItem({'Frosty Ear of a Troll'}, 10565, 30)
shopModule:addSellableItem({'Frosty Heart'}, 10578, 280)
shopModule:addSellableItem({'Gauze Bandage'}, 10566, 90)
shopModule:addSellableItem({'Gear Crystal'}, 10572, 200)
shopModule:addSellableItem({'Geomancer\'s Robe'}, 12414, 80)
shopModule:addSellableItem({'Geomancer\'s Staff'}, 12419, 120)
shopModule:addSellableItem({'Ghastly Dragon Head'}, 11366, 700)
shopModule:addSellableItem({'Ghostly Tissue'}, 10607, 90)
shopModule:addSellableItem({'Ghoul Snack'}, 12423, 60)
shopModule:addSellableItem({'Giant Eye'}, 11197, 380)
shopModule:addSellableItem({'Girlish Hair Decoration'}, 12399, 30)
shopModule:addSellableItem({'Glob of Acid Slime'}, 9967, 25)
shopModule:addSellableItem({'Glob of Mercury'}, 9966, 20)
shopModule:addSellableItem({'Glob of Tar'}, 9968, 30)
shopModule:addSellableItem({'Goblin Ear'}, 12495, 20)
shopModule:addSellableItem({'Green Dragon Leather'}, 5877, 100)
shopModule:addSellableItem({'Green Dragon Scale'}, 5920, 100)
shopModule:addSellableItem({'Hair of a Banshee'}, 12402, 350)
shopModule:addSellableItem({'Half-Digested Piece of Meat'}, 11200, 55)
shopModule:addSellableItem({'Half-Eaten Brain'}, 10576, 85)
shopModule:addSellableItem({'Hardened Bone'}, 5925, 70)
shopModule:addSellableItem({'Hellhound Slobber'}, 10554, 500)
shopModule:addSellableItem({'Hellspawn Tail'}, 11221, 475)
shopModule:addSellableItem({'High Guard Flag'}, 11332, 550)
shopModule:addSellableItem({'High Guard Shoulderplates'}, 11333, 130)
shopModule:addSellableItem({'Honeycomb'}, 5902, 40)
shopModule:addSellableItem({'Hunter\'s Quiver'}, 12425, 80)
shopModule:addSellableItem({'Hydra Egg'}, 4850, 500)
shopModule:addSellableItem({'Hydra Head'}, 11199, 600)
shopModule:addSellableItem({'Jewelled Belt'}, 12426, 180)
shopModule:addSellableItem({'Kongra\'s Shoulderpad'}, 12427, 100)
shopModule:addSellableItem({'Lancer Beetle Shell'}, 11372, 80)
shopModule:addSellableItem({'Legionnaire Flags'}, 11334, 500)
shopModule:addSellableItem({'Lion\'s Mane'}, 10608, 60)
shopModule:addSellableItem({'Lizard Essence'}, 12636, 300)
shopModule:addSellableItem({'Lizard Leather'}, 5876, 150)
shopModule:addSellableItem({'Lizard Scale'}, 5881, 120)
shopModule:addSellableItem({'Luminous Orb'}, 12410, 1000)
shopModule:addSellableItem({'Lump of Dirt'}, 10609, 10)
shopModule:addSellableItem({'Lump of Earth'}, 11222, 130)
shopModule:addSellableItem({'Mammoth Tusk'}, 11238, 100)
shopModule:addSellableItem({'Mantassin Tail'}, 12445, 280)
shopModule:addSellableItem({'Metal Spike'}, 11215, 320)
shopModule:addSellableItem({'Minotaur Horn'}, 12428, 75)
shopModule:addSellableItem({'Minotaur Leather'}, 5878, 80)
shopModule:addSellableItem({'Miraculum'}, 12430, 60)
shopModule:addSellableItem({'Morgaroth\'s Heart'}, 5943, 15000)
shopModule:addSellableItem({'Mutated Bat Ear'}, 10579, 420)
shopModule:addSellableItem({'Mutated Flesh'}, 11225, 50)
shopModule:addSellableItem({'Mutated Rat Tail'}, 10585, 150)
shopModule:addSellableItem({'Mystical Hourglass'}, 10577, 700)
shopModule:addSellableItem({'Necromantic Robe'}, 12431, 250)
shopModule:addSellableItem({'Nettle Blossom'}, 11231, 75)
shopModule:addSellableItem({'Noble Turban'}, 12442, 430)
shopModule:addSellableItem({'Orc Leather'}, 12435, 30)
shopModule:addSellableItem({'Orc Tooth'}, 11113, 150)
shopModule:addSellableItem({'Orcish Gear'}, 12433, 85)
shopModule:addSellableItem({'Orshabaal\'s Brain'}, 5808, 12000)
shopModule:addSellableItem({'Pelvis Bone'}, 12437, 30)
shopModule:addSellableItem({'Perfect Behemoth Fang'}, 5893, 250)
shopModule:addSellableItem({'Petrified Scream'}, 11337, 250)
shopModule:addSellableItem({'Piece of Archer Armor'}, 12439, 20)
shopModule:addSellableItem({'Piece of Crocodile Leather'}, 11196, 15)
shopModule:addSellableItem({'Piece of Dead Brain'}, 10580, 420)
shopModule:addSellableItem({'Piece of Hellfire Armor'}, 10581, 550)
shopModule:addSellableItem({'Piece of Scarab Shell'}, 10558, 45)
shopModule:addSellableItem({'Pig Foot'}, 10610, 10)
shopModule:addSellableItem({'Pile of Grave Earth'}, 12440, 25)
shopModule:addSellableItem({'Poison Spider Shell'}, 12441, 10)
shopModule:addSellableItem({'Poisonous Slime'}, 10557, 50)
shopModule:addSellableItem({'Polar Bear Paw'}, 10567, 30)
shopModule:addSellableItem({'Protective Charm'}, 12400, 60)
shopModule:addSellableItem({'Purple Robe'}, 12429, 110)
shopModule:addSellableItem({'Quara Bone'}, 12447, 500)
shopModule:addSellableItem({'Quara Eye'}, 12444, 350)
shopModule:addSellableItem({'Quara Pincers'}, 12446, 410)
shopModule:addSellableItem({'Quara Tentacle'}, 12443, 140)
shopModule:addSellableItem({'Red Dragon Leather'}, 5948, 200)
shopModule:addSellableItem({'Red Dragon Scale'}, 5882, 200)
shopModule:addSellableItem({'Rope Belt'}, 12448, 66)
shopModule:addSellableItem({'Rotten Piece of Cloth'}, 11208, 30)
shopModule:addSellableItem({'Sabretooth'}, 11228, 400)
shopModule:addSellableItem({'Safety Pin'}, 12449, 120)
shopModule:addSellableItem({'Sandcrawler Shell'}, 11373, 20)
shopModule:addSellableItem({'Scale of Corruption'}, 12629, 680)
shopModule:addSellableItem({'Scarab Pincers'}, 10548, 280)
shopModule:addSellableItem({'Scorpion Tail'}, 10568, 25)
shopModule:addSellableItem({'Scroll of Heroic Deeds'}, 12466, 230)
shopModule:addSellableItem({'Scythe Leg'}, 11229, 450)
shopModule:addSellableItem({'Sea Serpent Scale'}, 10583, 520)
shopModule:addSellableItem({'Shaggy Tail'}, 11324, 25)
shopModule:addSellableItem({'Shamanic Hood'}, 12434, 45)
shopModule:addSellableItem({'Shard'}, 7290, 2000)
shopModule:addSellableItem({'Shiny Stone'}, 11227, 500)
shopModule:addSellableItem({'Silky Fur'}, 11209, 35)
shopModule:addSellableItem({'Skull Belt'}, 12436, 80)
shopModule:addSellableItem({'Skunk Tail'}, 11191, 50)
shopModule:addSellableItem({'Small Flask of Eyedrops'}, 12468, 95)
shopModule:addSellableItem({'Small Notebook'}, 12406, 480)
shopModule:addSellableItem({'Small Pitchfork'}, 12469, 70)
shopModule:addSellableItem({'Snake Skin'}, 10611, 400)
shopModule:addSellableItem({'Spider Silk'}, 5879, 100)
shopModule:addSellableItem({'Spiked Iron Ball'}, 11325, 100)
shopModule:addSellableItem({'Stone Wing'}, 11195, 120)
shopModule:addSellableItem({'Strand of Medusa Hair'}, 11226, 600)
shopModule:addSellableItem({'Striped Fur'}, 11210, 50)
shopModule:addSellableItem({'Sulphurous Stone'}, 11232, 100)
shopModule:addSellableItem({'Swamp Grass'}, 10603, 20)
shopModule:addSellableItem({'Tail of Corruption'}, 12628, 240)
shopModule:addSellableItem({'Tarantula Egg'}, 11198, 80)
shopModule:addSellableItem({'Tattered Piece of Robe'}, 10601, 120)
shopModule:addSellableItem({'Tentacle Piece'}, 12622, 5000)
shopModule:addSellableItem({'Terramite Legs'}, 11371, 60)
shopModule:addSellableItem({'Terramite Shell'}, 11369, 170)
shopModule:addSellableItem({'Terrorbird Beak'}, 11190, 95)
shopModule:addSellableItem({'Thick Fur'}, 11224, 150)
shopModule:addSellableItem({'Thorn'}, 10560, 100)
shopModule:addSellableItem({'Trollroot'}, 12471, 50)
shopModule:addSellableItem({'Turtle Shell'}, 5899, 90)
shopModule:addSellableItem({'Undead Heart'}, 11367, 200)
shopModule:addSellableItem({'Unholy Bone'}, 11233, 480)
shopModule:addSellableItem({'Vampire Dust'}, 5905, 100)
shopModule:addSellableItem({'Vampire Teeth'}, 10602, 275)
shopModule:addSellableItem({'War Crystal'}, 10571, 460)
shopModule:addSellableItem({'Warmaster\'s Wristguards'}, 11322, 200)
shopModule:addSellableItem({'Warwolf Fur'}, 11235, 30)
shopModule:addSellableItem({'Weaver\'s Wandtip'}, 11314, 250)
shopModule:addSellableItem({'Werewolf Fur'}, 11234, 380)
shopModule:addSellableItem({'Widow\'s Mandibles'}, 11328, 110)
shopModule:addSellableItem({'Winged Tail'}, 11230, 800)
shopModule:addSellableItem({'Winter Wolf Fur'}, 11212, 20)
shopModule:addSellableItem({'Witch Broom'}, 10569, 60)
shopModule:addSellableItem({'Wolf Paw'}, 5897, 70)
shopModule:addSellableItem({'Wool'}, 11236, 15)
shopModule:addSellableItem({'Wyrm Scale'}, 10582, 400)
shopModule:addSellableItem({'Wyvern Talisman'}, 10561, 265)
shopModule:addSellableItem({'Zaogun Flag'}, 11330, 600)
shopModule:addSellableItem({'Zaogun\'s Shoulderplates'}, 11331, 150)
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!... only average loot is listed here
keywordHandler:addKeyword({'skinning products'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy Minotaur Leathers(80gp), Lizard Leathers(150gp), Green Dragon Leathers(100gp) Red Dragon Leathers(200gp). I also buy Hardened Bones(70gp), Behemoth Fangs(250gp), Neutral Matters(5k).'})
keywordHandler:addKeyword({'stake products'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy Vampire Dust(100gp), Demon Dust(300gp).'})
keywordHandler:addKeyword({'tails'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy Bony Tail(210gp), Dragon Tail Tip(100gp), Hellspawn Tail(475gp), Mantassin Tail(280gp), Mutated Rat Tail(150p), Scorpion Tail(25gp), Shaggy Tail(25gp), Skunk Tail(50gp) Tail of Corruption(240gp), Winged Tail(800gp).'})
keywordHandler:addKeyword({'scales'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy Green Dragon Scale(100gp), Lizard Scale(120gp), Red Dragon Scale(200gp), Scale of Corruption(680gp), Sea Serpent Scale(520gp) and Wyrm Scale(400gp).'})
keywordHandler:addKeyword({'bone'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy Antlers(50gp), Bone Shoulderplate(150gp), Brimstone Fangs(350gp), Carrion Worm Fang(35gp), Demon Horn(100gp), Mammoth Tusk(100gp), Minotaur Horn(75gp), Orc Tooth(150gp), Orc Tusk, Pelvis Bone(30p), Sabretooth(400gp), Tusk(100gp), Vampire Teeth(275gp).'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())