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

NPC Creature Product Buyer

soul4soul

Intermediate OT User
Joined
Aug 13, 2007
Messages
1,875
Solutions
3
Reaction score
128
Location
USA
This NPC buys ALL creature products including 8.6 items(thanks Elvarion for 8.6 items n the haunted wood).

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Blind Witch" script="data/npc/scripts/creatureproducts.lua" walkinterval="1000" floorchange="0">
	<health now="100" max="100"/>
	<look type="157" head="114" body="114" legs="114" feet="94" addons="3"/>
	<parameters>
		<parameter key="message_greet" value="Who's There?!! I collect herbs and creature products, do you have any for me to buy?"/>
		<parameter key="message_needmoremoney" value="come back when you get more money."/>
		<parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you? Get out of here!"/>
	</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
 
-- Start shop
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
 
 
--shop sells player buys
shopModule:addBuyableItem({'Blessed Wooden Stake'}, 5942, 12000, 1)
shopModule:addBuyableItem({'Obsidian Knife'}, 5908, 12000, 1) 
shopModule:addBuyableItem({'Fire Bug'}, 5468, 100, 1)
shopModule:addBuyableItem({'Mead Horn'}, 7141, 50, 1) 
shopModule:addBuyableItem({'Goat Grass'}, 2760, 150, 1) 
shopModule:addBuyableItem({'Blood Herb'}, 2798, 10000, 1) 
shopModule:addBuyableItem({'Rust Remover'}, 9930, 250, 1) 
 
 
--player sells shop buys
shopModule:addSellableItem({'Acorn'}, 11207, 100)
shopModule:addSellableItem({'Ancient Stone'}, 10548, 2000) 
shopModule:addSellableItem({'Antlers'}, 11208, 500) 
shopModule:addSellableItem({'Ape Fur'}, 5883, 1200) 
shopModule:addSellableItem({'Badger Fur'}, 11210, 150) 
shopModule:addSellableItem({'Bamboo Stick'}, 12362, 300)
shopModule:addSellableItem({'Banana Sash'}, 12428, 550)
shopModule:addSellableItem({'Bat Wing'}, 5894, 500)
shopModule:addSellableItem({'Battle Stone'}, 12364, 2900)
shopModule:addSellableItem({'Bear Paw'}, 5896, 1000) 
shopModule:addSellableItem({'Behemoth Claw'}, 5930, 20000) 
shopModule:addSellableItem({'Beholder Eye'}, 5898, 800) 
shopModule:addSellableItem({'Black Hood'}, 10561, 1900) 
shopModule:addSellableItem({'Black Wool'}, 12365, 3000)
shopModule:addSellableItem({'Blood Preservation'}, 12366, 3200)
shopModule:addSellableItem({'Bloody Pincers'}, 10549, 1000) 
shopModule:addSellableItem({'Boggy Dreads'}, 10583, 2000) 
shopModule:addSellableItem({'Bone Shoulderplate'}, 11315, 1500) 
shopModule:addSellableItem({'Bony Tail'}, 11188, 2100) 
shopModule:addSellableItem({'Book of Necromantic Rituals'}, 11231, 1800) 
shopModule:addSellableItem({'Book of Prayers'}, 10562, 1200) 
shopModule:addSellableItem({'Brimstone Fangs'}, 12619, 3500)
shopModule:addSellableItem({'Brimstone Shell'}, 12620, 2100)
shopModule:addSellableItem({'Broken Crossbow'}, 12368, 300) 
shopModule:addSellableItem({'Broken Draken Mail'}, 12577, 3500) 
shopModule:addSellableItem({'Broken Gladiator Shield'}, 10572, 1800) 
shopModule:addSellableItem({'Broken Halberd'}, 11329, 1000) 
shopModule:addSellableItem({'Broken Helmet'}, 12370, 200) 
shopModule:addSellableItem({'Broken Key Ring'}, 12569, 80000) 
shopModule:addSellableItem({'Broken Shamanic Staff'}, 12369, 350) 
shopModule:addSellableItem({'Broken Slicer'}, 12578, 1200) 
shopModule:addSellableItem({'Bunch of Troll Hair'}, 10605, 300) 
shopModule:addSellableItem({'Bundle of Cursed Straw'}, 10604, 8000) 
shopModule:addSellableItem({'Carniphila Seeds'}, 11211, 500)
shopModule:addSellableItem({'Carrion Worm Fang'}, 11186, 350) 
shopModule:addSellableItem({'Centipede Leg'}, 11212, 280) 
shopModule:addSellableItem({'Chicken Feather'}, 5890, 300) 
shopModule:addSellableItem({'Cobra Tongue'}, 10550, 150) 
shopModule:addSellableItem({'Colourful Feather'}, 12431, 1100) 
shopModule:addSellableItem({'Compass'}, 11213, 450) 
shopModule:addSellableItem({'Corrupted Flag'}, 11213, 7000) 
shopModule:addSellableItem({'Crab Pincers'}, 11183, 350) 
shopModule:addSellableItem({'Cultish Mask'}, 10554, 2800) 
shopModule:addSellableItem({'Cultish Robe'}, 10555, 1500) 
shopModule:addSellableItem({'Cultish Symbol'}, 12372, 5000) 
shopModule:addSellableItem({'Cursed Shoulder Spikes'}, 11321, 3200) 
shopModule:addSellableItem({'Cyclops Toe'}, 10573, 550) 
shopModule:addSellableItem({'Dark Rosary'}, 11214, 480) 
shopModule:addSellableItem({'Demon Dust'}, 5906, 3000) 
shopModule:addSellableItem({'Demon Horn'}, 5954, 10000) 
shopModule:addSellableItem({'Demonic Skeletal Hand'}, 10563, 800) 
shopModule:addSellableItem({'Dirty Turban'}, 12373, 1200) 
shopModule:addSellableItem({'Downy Feather'}, 12601, 200)  
shopModule:addSellableItem({'Dragon Claw'}, 10020, 80000) 
shopModule:addSellableItem({'Dragon Priest\'s Wandtip'}, 11355, 1750) 
shopModule:addSellableItem({'Dragon Tail'}, 12374, 1000) 
shopModule:addSellableItem({'Draken Sulphur'}, 12575, 5500)
shopModule:addSellableItem({'Draken Wristbands'}, 12576, 4300)
shopModule:addSellableItem({'Elder Beholder Tentacle'}, 11187, 1500)
shopModule:addSellableItem({'Elven Astral Observer'}, 12382, 900)
shopModule:addSellableItem({'Elven Scouting Glass'}, 12381, 500)
shopModule:addSellableItem({'Elvish Talisman'}, 10551, 450)
shopModule:addSellableItem({'Essence of a Bad Dream'}, 11217, 3600)
shopModule:addSellableItem({'Eye of Corruption'}, 12588, 3900)
shopModule:addSellableItem({'ferumbras hat'}, 5903, 500000)
shopModule:addSellableItem({'Fiery Heart'}, 10552, 3750)
shopModule:addSellableItem({'Fish Fin'}, 5895, 1500)
shopModule:addSellableItem({'Flask of Embalming Fluid'}, 12383, 300)
shopModule:addSellableItem({'Frost Giant Pelt'}, 10574, 1600)
shopModule:addSellableItem({'Frosty Ear of a Troll'}, 10564, 300)
shopModule:addSellableItem({'Frosty Heart'}, 10577, 2800)
shopModule:addSellableItem({'Gauze Bandage'}, 10565, 900)
shopModule:addSellableItem({'Gear Crystal'}, 10571, 2000)
shopModule:addSellableItem({'Geomancer\'s Robe'}, 12375, 800)
shopModule:addSellableItem({'Geomancer\'s Staff'}, 12380, 1200)
shopModule:addSellableItem({'Ghastly Dragon Head'}, 11360, 7000)
shopModule:addSellableItem({'Ghostly Tissue'}, 10606, 900)
shopModule:addSellableItem({'Ghoul Snack'}, 12384, 600)
shopModule:addSellableItem({'Giant Eye'}, 11191, 3800)
shopModule:addSellableItem({'Girlish Hair Decoration'}, 12360, 300)
shopModule:addSellableItem({'Glob of Acid Slime'}, 9967, 250)
shopModule:addSellableItem({'Glob of Mercury'}, 9966, 200)
shopModule:addSellableItem({'Glob of Tar'}, 9968, 300)
shopModule:addSellableItem({'Goblin Ear'}, 12456, 200)
shopModule:addSellableItem({'Green Dragon Leather'}, 5877, 1000)
shopModule:addSellableItem({'Green Dragon Scale'}, 5920, 1000)
shopModule:addSellableItem({'Hair of a Banshee'}, 12363, 3500)
shopModule:addSellableItem({'Half-Digested Piece of Meat'}, 11194, 550)
shopModule:addSellableItem({'Half-Eaten Brain'}, 10575, 850)
shopModule:addSellableItem({'Hardened Bone'}, 5925, 700)
shopModule:addSellableItem({'Haunted Piece of Wood'}, 10599, 1150)
shopModule:addSellableItem({'Hellhound Slobber'}, 10553, 5000)
shopModule:addSellableItem({'Hellspawn Tail'}, 11215, 4750)
shopModule:addSellableItem({'High Guard Flag'}, 11326, 5500)
shopModule:addSellableItem({'High Guard Shoulderplates'}, 11327, 1300)
shopModule:addSellableItem({'Honeycomb'}, 5902, 400)
shopModule:addSellableItem({'Hunter\'s Quiver'}, 12386, 800)
shopModule:addSellableItem({'Hydra Egg'}, 4850, 5000)
shopModule:addSellableItem({'Hydra Head'}, 11193, 6000)
shopModule:addSellableItem({'Jewelled Belt'}, 12387, 1800)
shopModule:addSellableItem({'Kongra\'s Shoulderpad'}, 12388, 1000)
shopModule:addSellableItem({'Lancer Beetle Shell'}, 11366, 800)
shopModule:addSellableItem({'Legionnaire Flags'}, 11328, 5000)
shopModule:addSellableItem({'Lion\'s Mane'}, 10607, 600)
shopModule:addSellableItem({'Lizard Essence'}, 12597, 3000)
shopModule:addSellableItem({'Lizard Leather'}, 5876, 1500)
shopModule:addSellableItem({'Lizard Scale'}, 5881, 1200)
shopModule:addSellableItem({'Luminous Orb'}, 12371, 10000)
shopModule:addSellableItem({'Lump of Dirt'}, 10608, 100)
shopModule:addSellableItem({'Lump of Earth'}, 11216, 1300)
shopModule:addSellableItem({'Mammoth Tusk'}, 11216, 1000)
shopModule:addSellableItem({'Mantassin Tail'}, 12406, 280)
shopModule:addSellableItem({'Metal Spike'}, 11209, 3200)
shopModule:addSellableItem({'Minotaur Horn'}, 12389, 750)
shopModule:addSellableItem({'Minotaur Leather'}, 5878, 800)
shopModule:addSellableItem({'Miraculum'}, 12391, 600)
shopModule:addSellableItem({'Morgaroth\'s Heart'}, 5943, 150000)
shopModule:addSellableItem({'Mutated Bat Ear'}, 10578, 4200)
shopModule:addSellableItem({'Mutated Flesh'}, 11219, 500)
shopModule:addSellableItem({'Mutated Rat Tail'}, 10584, 1500)
shopModule:addSellableItem({'Mystical Hourglass'}, 10576, 7000) 
shopModule:addSellableItem({'Necromantic Robe'}, 12392, 2500) 
shopModule:addSellableItem({'Nettle Blossom'}, 11225, 750) 
shopModule:addSellableItem({'Noble Turban'}, 12403, 4300) 
shopModule:addSellableItem({'Orc Leather'}, 12396, 300) 
shopModule:addSellableItem({'Orc Tooth'}, 11109, 1500) 
shopModule:addSellableItem({'Orcish Gear'}, 12394, 850) 
shopModule:addSellableItem({'Orshabaal\'s Brain'}, 5808, 120000) 
shopModule:addSellableItem({'Pelvis Bone'}, 12398, 300) 
shopModule:addSellableItem({'Perfect Behemoth Fang'}, 5893, 2500) 
shopModule:addSellableItem({'Petrified Scream'}, 11331, 2500) 
shopModule:addSellableItem({'Piece of Archer Armor'}, 12400, 200) 
shopModule:addSellableItem({'Piece of Crocodile Leather'}, 11190, 150) 
shopModule:addSellableItem({'Piece of Dead Brain'}, 10579, 4200) 
shopModule:addSellableItem({'Piece of Hellfire Armor'}, 10580, 5500) 
shopModule:addSellableItem({'Piece of Scarab Shell'}, 10557, 450) 
shopModule:addSellableItem({'Piece of Warrior Armor'}, 12399, 500) 
shopModule:addSellableItem({'Pig Foot'}, 10609, 100) 
shopModule:addSellableItem({'Pile of Grave Earth'}, 12401, 250) 
shopModule:addSellableItem({'Poison Spider Shell'}, 12402, 100) 
shopModule:addSellableItem({'Poisonous Slime'}, 10556, 500) 
shopModule:addSellableItem({'Polar Bear Paw'}, 10566, 300) 
shopModule:addSellableItem({'Protective Charm'}, 12361, 600) 
shopModule:addSellableItem({'Purple Robe'}, 12390, 1100) 
shopModule:addSellableItem({'Quara Bone'}, 12408, 5000)
shopModule:addSellableItem({'Quara Eye'}, 12405, 3500) 
shopModule:addSellableItem({'Quara Pincers'}, 12407, 4100) 
shopModule:addSellableItem({'Quara Tentacle'}, 12404, 1400) 
shopModule:addSellableItem({'Red Dragon Leather'}, 5948, 2000) 
shopModule:addSellableItem({'Red Dragon Scale'}, 5882, 2000) 
shopModule:addSellableItem({'Rope Belt'}, 12409, 660) 
shopModule:addSellableItem({'Rotten Piece of Cloth'}, 11202, 300) 
shopModule:addSellableItem({'Sabretooth'}, 11222, 4000) 
shopModule:addSellableItem({'Safety Pin'}, 12410, 1200) 
shopModule:addSellableItem({'Sandcrawler Shell'}, 11367, 200) 
shopModule:addSellableItem({'Scale of Corruption'}, 12590, 6800) 
shopModule:addSellableItem({'Scarab Pincers'}, 10547, 2800) 
shopModule:addSellableItem({'Scorpion Tail'}, 10567, 250) 
shopModule:addSellableItem({'Scroll of Heroic Deeds'}, 12427, 2300) 
shopModule:addSellableItem({'Scythe Leg'}, 11223, 4500) 
shopModule:addSellableItem({'Sea Serpent Scale'}, 10582, 5200) 
shopModule:addSellableItem({'Shaggy Tail'}, 11318, 250) 
shopModule:addSellableItem({'Shamanic Hood'}, 12395, 450) 
shopModule:addSellableItem({'Shard'}, 7290, 20000) 
shopModule:addSellableItem({'Shiny Stone'}, 11221, 5000) 
shopModule:addSellableItem({'Silky Fur'}, 11203, 350) 
shopModule:addSellableItem({'Skull Belt'}, 12397, 800) 
shopModule:addSellableItem({'Skunk Tail'}, 11185, 509) 
shopModule:addSellableItem({'Small Flask of Eyedrops'}, 12429, 959) 
shopModule:addSellableItem({'Small Notebook'}, 12367, 4809) 
shopModule:addSellableItem({'Small Pitchfork'}, 12430, 709) 
shopModule:addSellableItem({'Snake Skin'}, 10610, 4009) 
shopModule:addSellableItem({'Spider Fangs'}, 8859, 100) 
shopModule:addSellableItem({'Spider Silk'}, 5879, 1000) 
shopModule:addSellableItem({'Spiked Iron Ball'}, 11319, 1000) 
shopModule:addSellableItem({'Spooky Blue Eye'}, 10558, 950) 
shopModule:addSellableItem({'Stone Wing'}, 11189, 1200) 
shopModule:addSellableItem({'Strand of Medusa Hair'}, 11220, 6000) 
shopModule:addSellableItem({'Striped Fur'}, 11204, 500) 
shopModule:addSellableItem({'Sulphurous Stone'}, 11226, 1000) 
shopModule:addSellableItem({'Swamp Grass'}, 10602, 200) 
shopModule:addSellableItem({'Tail of Corruption'}, 12589, 2400)
shopModule:addSellableItem({'Tarantula Egg'}, 11192, 800) 
shopModule:addSellableItem({'Tattered Piece of Robe'}, 10600, 1200) 
shopModule:addSellableItem({'Tentacle Piece'}, 12583, 50000) 
shopModule:addSellableItem({'Terramite Legs'}, 11365, 600) 
shopModule:addSellableItem({'Terramite Shell'}, 11363, 1700) 
shopModule:addSellableItem({'Terrorbird Beak'}, 11184, 950) 
shopModule:addSellableItem({'Thick Fur'}, 11218, 1500) 
shopModule:addSellableItem({'Thorn'}, 10559, 1000) 
shopModule:addSellableItem({'Trollroot'}, 12432, 500) 
shopModule:addSellableItem({'Turtle Shell'}, 5899, 900) 
shopModule:addSellableItem({'Tusk'}, 8614, 1000) 
shopModule:addSellableItem({'Undead Heart'}, 11361, 2000) 
shopModule:addSellableItem({'Unholy Bone'}, 11227, 4800) 
shopModule:addSellableItem({'Vampire Dust'}, 5905, 1000) 
shopModule:addSellableItem({'Vampire Teeth'}, 10601, 2750) 
shopModule:addSellableItem({'War Crystal'}, 10570, 4600) 
shopModule:addSellableItem({'Warmaster\'s Wristguards'}, 11316, 2000) 
shopModule:addSellableItem({'Warwolf Fur'}, 11229, 300) 
shopModule:addSellableItem({'Weaver\'s Wandtip'}, 11308, 2500) 
shopModule:addSellableItem({'Werewolf Fur'}, 11228, 3800) 
shopModule:addSellableItem({'Widow\'s Mandibles'}, 11322, 1100) 
shopModule:addSellableItem({'Winged Tail'}, 11224, 8000) 
shopModule:addSellableItem({'Winter Wolf Fur'}, 11206, 200) 
shopModule:addSellableItem({'Witch Broom'}, 10568, 600) 
shopModule:addSellableItem({'Wolf Paw'}, 5897, 700) 
shopModule:addSellableItem({'Wool'}, 11230, 150) 
shopModule:addSellableItem({'Wyrm Scale'}, 10581, 4000) 
shopModule:addSellableItem({'Wyvern Talisman'}, 10560, 2650) 
shopModule:addSellableItem({'Zaogun Flag'}, 11324, 6000) 
shopModule:addSellableItem({'Zaogun\'s Shoulderplates'}, 11325, 1500) 
 
 
-- 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())

NOTE: all the prices are 10x the RL price so just remember to remove a '0' off of every1 if you want the cip prices
 
Last edited:
updated thanks for the positive feed back.
 
Edited the script to include the 8.6 items =)
(Still missing the Haunted Piece of Wood, Didnt have it in my items.xml..) -- NOT ANYMORE!!<--

Also changed
Lua:
shopModule:addSellableItem({'Dragon Tail Tip'}, 12374, 1000)
To
Lua:
shopModule:addSellableItem({'Dragon Tail'}, 12374, 1000)
Since thats the name ^^,

Here is the code that goes into Items.xml for Haunted~
XML:
	<item id="10599" article="a" name="haunted piece of wood" plural="haunted pieces of wood">
		<attribute key="weight" value="226" />
	</item>

Here is the script. all Cred to Soul
Lua:
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({'Blessed Wooden Stake'}, 5942, 12000, 1)
shopModule:addBuyableItem({'Obsidian Knife'}, 5908, 12000, 1) 
shopModule:addBuyableItem({'Fire Bug'}, 5468, 100, 1)
shopModule:addBuyableItem({'Mead Horn'}, 7141, 50, 1) 
shopModule:addBuyableItem({'Goat Grass'}, 2760, 150, 1) 
shopModule:addBuyableItem({'Blood Herb'}, 2798, 10000, 1) 
shopModule:addBuyableItem({'Rust Remover'}, 9930, 250, 1) 


--player sells shop buys
shopModule:addSellableItem({'Acorn'}, 11207, 100)
shopModule:addSellableItem({'Ancient Stone'}, 10548, 2000) 
shopModule:addSellableItem({'Antlers'}, 11208, 500) 
shopModule:addSellableItem({'Ape Fur'}, 5883, 1200) 
shopModule:addSellableItem({'Badger Fur'}, 11210, 150) 
shopModule:addSellableItem({'Bamboo Stick'}, 12362, 300)
shopModule:addSellableItem({'Banana Sash'}, 12428, 550)
shopModule:addSellableItem({'Bat Wing'}, 5894, 500)
shopModule:addSellableItem({'Battle Stone'}, 12364, 2900)
shopModule:addSellableItem({'Bear Paw'}, 5896, 1000) 
shopModule:addSellableItem({'Behemoth Claw'}, 5930, 20000) 
shopModule:addSellableItem({'Beholder Eye'}, 5898, 800) 
shopModule:addSellableItem({'Black Hood'}, 10561, 1900) 
shopModule:addSellableItem({'Black Wool'}, 12365, 3000)
shopModule:addSellableItem({'Blood Preservation'}, 12366, 3200)
shopModule:addSellableItem({'Bloody Pincers'}, 10549, 1000) 
shopModule:addSellableItem({'Boggy Dreads'}, 10583, 2000) 
shopModule:addSellableItem({'Bone Shoulderplate'}, 11315, 1500) 
shopModule:addSellableItem({'Bony Tail'}, 11188, 2100) 
shopModule:addSellableItem({'Book of Necromantic Rituals'}, 11231, 1800) 
shopModule:addSellableItem({'Book of Prayers'}, 10562, 1200) 
shopModule:addSellableItem({'Brimstone Fangs'}, 12619, 3500)
shopModule:addSellableItem({'Brimstone Shell'}, 12620, 2100)
shopModule:addSellableItem({'Broken Crossbow'}, 12368, 300) 
shopModule:addSellableItem({'Broken Draken Mail'}, 12577, 3500) 
shopModule:addSellableItem({'Broken Gladiator Shield'}, 10572, 1800) 
shopModule:addSellableItem({'Broken Halberd'}, 11329, 1000) 
shopModule:addSellableItem({'Broken Helmet'}, 12370, 200) 
shopModule:addSellableItem({'Broken Key Ring'}, 12569, 80000) 
shopModule:addSellableItem({'Broken Shamanic Staff'}, 12369, 350) 
shopModule:addSellableItem({'Broken Slicer'}, 12578, 1200) 
shopModule:addSellableItem({'Bunch of Troll Hair'}, 10605, 300) 
shopModule:addSellableItem({'Bundle of Cursed Straw'}, 10604, 8000) 
shopModule:addSellableItem({'Carniphila Seeds'}, 11211, 500)
shopModule:addSellableItem({'Carrion Worm Fang'}, 11186, 350) 
shopModule:addSellableItem({'Centipede Leg'}, 11212, 280) 
shopModule:addSellableItem({'Chicken Feather'}, 5890, 300) 
shopModule:addSellableItem({'Cobra Tongue'}, 10550, 150) 
shopModule:addSellableItem({'Colourful Feather'}, 12431, 1100) 
shopModule:addSellableItem({'Compass'}, 11213, 450) 
shopModule:addSellableItem({'Corrupted Flag'}, 11213, 7000) 
shopModule:addSellableItem({'Crab Pincers'}, 11183, 350) 
shopModule:addSellableItem({'Cultish Mask'}, 10554, 2800) 
shopModule:addSellableItem({'Cultish Robe'}, 10555, 1500) 
shopModule:addSellableItem({'Cultish Symbol'}, 12372, 5000) 
shopModule:addSellableItem({'Cursed Shoulder Spikes'}, 11321, 3200) 
shopModule:addSellableItem({'Cyclops Toe'}, 10573, 550) 
shopModule:addSellableItem({'Dark Rosary'}, 11214, 480) 
shopModule:addSellableItem({'Demon Dust'}, 5906, 3000) 
shopModule:addSellableItem({'Demon Horn'}, 5954, 10000) 
shopModule:addSellableItem({'Demonic Skeletal Hand'}, 10563, 800) 
shopModule:addSellableItem({'Dirty Turban'}, 12373, 1200) 
shopModule:addSellableItem({'Downy Feather'}, 12601, 200)  
shopModule:addSellableItem({'Dragon Claw'}, 10020, 80000) 
shopModule:addSellableItem({'Dragon Priest\'s Wandtip'}, 11355, 1750) 
shopModule:addSellableItem({'Dragon Tail'}, 12374, 1000) 
shopModule:addSellableItem({'Draken Sulphur'}, 12575, 5500)
shopModule:addSellableItem({'Draken Wristbands'}, 12576, 4300)
shopModule:addSellableItem({'Elder Beholder Tentacle'}, 11187, 1500)
shopModule:addSellableItem({'Elven Astral Observer'}, 12382, 900)
shopModule:addSellableItem({'Elven Scouting Glass'}, 12381, 500)
shopModule:addSellableItem({'Elvish Talisman'}, 10551, 450)
shopModule:addSellableItem({'Essence of a Bad Dream'}, 11217, 3600)
shopModule:addSellableItem({'Eye of Corruption'}, 12588, 3900)
shopModule:addSellableItem({'ferumbras hat'}, 5903, 500000)
shopModule:addSellableItem({'Fiery Heart'}, 10552, 3750)
shopModule:addSellableItem({'Fish Fin'}, 5895, 1500)
shopModule:addSellableItem({'Flask of Embalming Fluid'}, 12383, 300)
shopModule:addSellableItem({'Frost Giant Pelt'}, 10574, 1600)
shopModule:addSellableItem({'Frosty Ear of a Troll'}, 10564, 300)
shopModule:addSellableItem({'Frosty Heart'}, 10577, 2800)
shopModule:addSellableItem({'Gauze Bandage'}, 10565, 900)
shopModule:addSellableItem({'Gear Crystal'}, 10571, 2000)
shopModule:addSellableItem({'Geomancer\'s Robe'}, 12375, 800)
shopModule:addSellableItem({'Geomancer\'s Staff'}, 12380, 1200)
shopModule:addSellableItem({'Ghastly Dragon Head'}, 11360, 7000)
shopModule:addSellableItem({'Ghostly Tissue'}, 10606, 900)
shopModule:addSellableItem({'Ghoul Snack'}, 12384, 600)
shopModule:addSellableItem({'Giant Eye'}, 11191, 3800)
shopModule:addSellableItem({'Girlish Hair Decoration'}, 12360, 300)
shopModule:addSellableItem({'Glob of Acid Slime'}, 9967, 250)
shopModule:addSellableItem({'Glob of Mercury'}, 9966, 200)
shopModule:addSellableItem({'Glob of Tar'}, 9968, 300)
shopModule:addSellableItem({'Goblin Ear'}, 12456, 200)
shopModule:addSellableItem({'Green Dragon Leather'}, 5877, 1000)
shopModule:addSellableItem({'Green Dragon Scale'}, 5920, 1000)
shopModule:addSellableItem({'Hair of a Banshee'}, 12363, 3500)
shopModule:addSellableItem({'Half-Digested Piece of Meat'}, 11194, 550)
shopModule:addSellableItem({'Half-Eaten Brain'}, 10575, 850)
shopModule:addSellableItem({'Hardened Bone'}, 5925, 700)
shopModule:addSellableItem({'Haunted Piece of Wood'}, 10599, 1150)
shopModule:addSellableItem({'Hellhound Slobber'}, 10553, 5000)
shopModule:addSellableItem({'Hellspawn Tail'}, 11215, 4750)
shopModule:addSellableItem({'High Guard Flag'}, 11326, 5500)
shopModule:addSellableItem({'High Guard Shoulderplates'}, 11327, 1300)
shopModule:addSellableItem({'Honeycomb'}, 5902, 400)
shopModule:addSellableItem({'Hunter\'s Quiver'}, 12386, 800)
shopModule:addSellableItem({'Hydra Egg'}, 4850, 5000)
shopModule:addSellableItem({'Hydra Head'}, 11193, 6000)
shopModule:addSellableItem({'Jewelled Belt'}, 12387, 1800)
shopModule:addSellableItem({'Kongra\'s Shoulderpad'}, 12388, 1000)
shopModule:addSellableItem({'Lancer Beetle Shell'}, 11366, 800)
shopModule:addSellableItem({'Legionnaire Flags'}, 11328, 5000)
shopModule:addSellableItem({'Lion\'s Mane'}, 10607, 600)
shopModule:addSellableItem({'Lizard Essence'}, 12597, 3000)
shopModule:addSellableItem({'Lizard Leather'}, 5876, 1500)
shopModule:addSellableItem({'Lizard Scale'}, 5881, 1200)
shopModule:addSellableItem({'Luminous Orb'}, 12371, 10000)
shopModule:addSellableItem({'Lump of Dirt'}, 10608, 100)
shopModule:addSellableItem({'Lump of Earth'}, 11216, 1300)
shopModule:addSellableItem({'Mammoth Tusk'}, 11216, 1000)
shopModule:addSellableItem({'Mantassin Tail'}, 12406, 280)
shopModule:addSellableItem({'Metal Spike'}, 11209, 3200)
shopModule:addSellableItem({'Minotaur Horn'}, 12389, 750)
shopModule:addSellableItem({'Minotaur Leather'}, 5878, 800)
shopModule:addSellableItem({'Miraculum'}, 12391, 600)
shopModule:addSellableItem({'Morgaroth\'s Heart'}, 5943, 150000)
shopModule:addSellableItem({'Mutated Bat Ear'}, 10578, 4200)
shopModule:addSellableItem({'Mutated Flesh'}, 11219, 500)
shopModule:addSellableItem({'Mutated Rat Tail'}, 10584, 1500)
shopModule:addSellableItem({'Mystical Hourglass'}, 10576, 7000) 
shopModule:addSellableItem({'Necromantic Robe'}, 12392, 2500) 
shopModule:addSellableItem({'Nettle Blossom'}, 11225, 750) 
shopModule:addSellableItem({'Noble Turban'}, 12403, 4300) 
shopModule:addSellableItem({'Orc Leather'}, 12396, 300) 
shopModule:addSellableItem({'Orc Tooth'}, 11109, 1500) 
shopModule:addSellableItem({'Orcish Gear'}, 12394, 850) 
shopModule:addSellableItem({'Orshabaal\'s Brain'}, 5808, 120000) 
shopModule:addSellableItem({'Pelvis Bone'}, 12398, 300) 
shopModule:addSellableItem({'Perfect Behemoth Fang'}, 5893, 2500) 
shopModule:addSellableItem({'Petrified Scream'}, 11331, 2500) 
shopModule:addSellableItem({'Piece of Archer Armor'}, 12400, 200) 
shopModule:addSellableItem({'Piece of Crocodile Leather'}, 11190, 150) 
shopModule:addSellableItem({'Piece of Dead Brain'}, 10579, 4200) 
shopModule:addSellableItem({'Piece of Hellfire Armor'}, 10580, 5500) 
shopModule:addSellableItem({'Piece of Scarab Shell'}, 10557, 450) 
shopModule:addSellableItem({'Piece of Warrior Armor'}, 12399, 500) 
shopModule:addSellableItem({'Pig Foot'}, 10609, 100) 
shopModule:addSellableItem({'Pile of Grave Earth'}, 12401, 250) 
shopModule:addSellableItem({'Poison Spider Shell'}, 12402, 100) 
shopModule:addSellableItem({'Poisonous Slime'}, 10556, 500) 
shopModule:addSellableItem({'Polar Bear Paw'}, 10566, 300) 
shopModule:addSellableItem({'Protective Charm'}, 12361, 600) 
shopModule:addSellableItem({'Purple Robe'}, 12390, 1100) 
shopModule:addSellableItem({'Quara Bone'}, 12408, 5000)
shopModule:addSellableItem({'Quara Eye'}, 12405, 3500) 
shopModule:addSellableItem({'Quara Pincers'}, 12407, 4100) 
shopModule:addSellableItem({'Quara Tentacle'}, 12404, 1400) 
shopModule:addSellableItem({'Red Dragon Leather'}, 5948, 2000) 
shopModule:addSellableItem({'Red Dragon Scale'}, 5882, 2000) 
shopModule:addSellableItem({'Rope Belt'}, 12409, 660) 
shopModule:addSellableItem({'Rotten Piece of Cloth'}, 11202, 300) 
shopModule:addSellableItem({'Sabretooth'}, 11222, 4000) 
shopModule:addSellableItem({'Safety Pin'}, 12410, 1200) 
shopModule:addSellableItem({'Sandcrawler Shell'}, 11367, 200) 
shopModule:addSellableItem({'Scale of Corruption'}, 12590, 6800) 
shopModule:addSellableItem({'Scarab Pincers'}, 10547, 2800) 
shopModule:addSellableItem({'Scorpion Tail'}, 10567, 250) 
shopModule:addSellableItem({'Scroll of Heroic Deeds'}, 12427, 2300) 
shopModule:addSellableItem({'Scythe Leg'}, 11223, 4500) 
shopModule:addSellableItem({'Sea Serpent Scale'}, 10582, 5200) 
shopModule:addSellableItem({'Shaggy Tail'}, 11318, 250) 
shopModule:addSellableItem({'Shamanic Hood'}, 12395, 450) 
shopModule:addSellableItem({'Shard'}, 7290, 20000) 
shopModule:addSellableItem({'Shiny Stone'}, 11221, 5000) 
shopModule:addSellableItem({'Silky Fur'}, 11203, 350) 
shopModule:addSellableItem({'Skull Belt'}, 12397, 800) 
shopModule:addSellableItem({'Skunk Tail'}, 11185, 509) 
shopModule:addSellableItem({'Small Flask of Eyedrops'}, 12429, 959) 
shopModule:addSellableItem({'Small Notebook'}, 12367, 4809) 
shopModule:addSellableItem({'Small Pitchfork'}, 12430, 709) 
shopModule:addSellableItem({'Snake Skin'}, 10610, 4009) 
shopModule:addSellableItem({'Spider Fangs'}, 8859, 100) 
shopModule:addSellableItem({'Spider Silk'}, 5879, 1000) 
shopModule:addSellableItem({'Spiked Iron Ball'}, 11319, 1000) 
shopModule:addSellableItem({'Spooky Blue Eye'}, 10558, 950) 
shopModule:addSellableItem({'Stone Wing'}, 11189, 1200) 
shopModule:addSellableItem({'Strand of Medusa Hair'}, 11220, 6000) 
shopModule:addSellableItem({'Striped Fur'}, 11204, 500) 
shopModule:addSellableItem({'Sulphurous Stone'}, 11226, 1000) 
shopModule:addSellableItem({'Swamp Grass'}, 10602, 200) 
shopModule:addSellableItem({'Tail of Corruption'}, 12589, 2400)
shopModule:addSellableItem({'Tarantula Egg'}, 11192, 800) 
shopModule:addSellableItem({'Tattered Piece of Robe'}, 10600, 1200) 
shopModule:addSellableItem({'Tentacle Piece'}, 12583, 50000) 
shopModule:addSellableItem({'Terramite Legs'}, 11365, 600) 
shopModule:addSellableItem({'Terramite Shell'}, 11363, 1700) 
shopModule:addSellableItem({'Terrorbird Beak'}, 11184, 950) 
shopModule:addSellableItem({'Thick Fur'}, 11218, 1500) 
shopModule:addSellableItem({'Thorn'}, 10559, 1000) 
shopModule:addSellableItem({'Trollroot'}, 12432, 500) 
shopModule:addSellableItem({'Turtle Shell'}, 5899, 900) 
shopModule:addSellableItem({'Tusk'}, 8614, 1000) 
shopModule:addSellableItem({'Undead Heart'}, 11361, 2000) 
shopModule:addSellableItem({'Unholy Bone'}, 11227, 4800) 
shopModule:addSellableItem({'Vampire Dust'}, 5905, 1000) 
shopModule:addSellableItem({'Vampire Teeth'}, 10601, 2750) 
shopModule:addSellableItem({'War Crystal'}, 10570, 4600) 
shopModule:addSellableItem({'Warmaster\'s Wristguards'}, 11316, 2000) 
shopModule:addSellableItem({'Warwolf Fur'}, 11229, 300) 
shopModule:addSellableItem({'Weaver\'s Wandtip'}, 11308, 2500) 
shopModule:addSellableItem({'Werewolf Fur'}, 11228, 3800) 
shopModule:addSellableItem({'Widow\'s Mandibles'}, 11322, 1100) 
shopModule:addSellableItem({'Winged Tail'}, 11224, 8000) 
shopModule:addSellableItem({'Winter Wolf Fur'}, 11206, 200) 
shopModule:addSellableItem({'Witch Broom'}, 10568, 600) 
shopModule:addSellableItem({'Wolf Paw'}, 5897, 700) 
shopModule:addSellableItem({'Wool'}, 11230, 150) 
shopModule:addSellableItem({'Wyrm Scale'}, 10581, 4000) 
shopModule:addSellableItem({'Wyvern Talisman'}, 10560, 2650) 
shopModule:addSellableItem({'Zaogun Flag'}, 11324, 6000) 
shopModule:addSellableItem({'Zaogun\'s Shoulderplates'}, 11325, 1500) 


-- 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())
 
Last edited:
ahhh! thanks for finding the haunted piece of wood. updated my first post with your script thanks man.
 
Needed it myself also! Was really just a coincidence i found it.. Was browsing items.xml like i always do and found that i was missing some numbers and went online on my gm and started spawning items one after another and looking them up on tibiawiki and there it was the haunted wood ^^, Also found some Strange new 8.6 items when playing around with items i dont have listed.. Like living plants (flesh eating looking ones o_O)

Well glad i could help =)
Could you post your codes in LUA/XML? Much easier to read ^_^,
 
ha i do the same thing. thats how i found all the other 8.54 items i was missing for this NPC. use xml/lua tags breaks the tabbing in scripts.
 
This is the error I'm getting, might be cuz Im using 8.54

Code:
[28/09/2010 18:28:24] [Error - Npc interface] 
[28/09/2010 18:28:24] data/npc/scripts/creatureproducts.lua
[28/09/2010 18:28:24] Description: 
[28/09/2010 18:28:24] data/lib/050-function.lua:222: attempt to index a boolean value
[28/09/2010 18:28:24] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/creatureproducts.lua

And my 050-function.lua

Code:
function doPlayerGiveItem(cid, itemid, amount, subType)
	local item = 0
	if(isItemStackable(itemid)) then
		item = doCreateItemEx(itemid, amount)
		if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then
			return false
		end
	else
		for i = 1, amount do
			item = doCreateItemEx(itemid, subType)
			if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then
				return false
			end
		end
	end

	return true
end

function doPlayerGiveItemContainer(cid, containerid, itemid, amount, subType)
	for i = 1, amount do
		local container = doCreateItemEx(containerid, 1)
		for x = 1, getContainerCapById(containerid) do
			doAddContainerItem(container, itemid, subType)
		end

		if(doPlayerAddItemEx(cid, container, true) ~= RETURNVALUE_NOERROR) then
			return false
		end
	end

	return true
end

function doPlayerTakeItem(cid, itemid, amount)
	return getPlayerItemCount(cid, itemid) >= amount and doPlayerRemoveItem(cid, itemid, amount)
end

function doPlayerBuyItem(cid, itemid, count, cost, charges)
	return doPlayerRemoveMoney(cid, cost) and doPlayerGiveItem(cid, itemid, count, charges)
end

function doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)
	return doPlayerRemoveMoney(cid, cost) and doPlayerGiveItemContainer(cid, containerid, itemid, count, charges)
end

function doPlayerSellItem(cid, itemid, count, cost)
	if(not doPlayerTakeItem(cid, itemid, count)) then
		return false
	end

	if(not doPlayerAddMoney(cid, cost)) then
		error('[doPlayerSellItem] Could not add money to: ' .. getPlayerName(cid) .. ' (' .. cost .. 'gp).')
	end

	return true
end

function doPlayerWithdrawMoney(cid, amount)
	if(not getBooleanFromString(getConfigInfo('bankSystem'))) then
		return false
	end

	local balance = getPlayerBalance(cid)
	if(amount > balance or not doPlayerAddMoney(cid, amount)) then
		return false
	end

	doPlayerSetBalance(cid, balance - amount)
	return true
end

function doPlayerDepositMoney(cid, amount)
	if(not getBooleanFromString(getConfigInfo('bankSystem'))) then
		return false
	end

	if(not doPlayerRemoveMoney(cid, amount)) then
		return false
	end

	doPlayerSetBalance(cid, getPlayerBalance(cid) + amount)
	return true
end

function isPremium(cid)
	return (isPlayer(cid) and (getPlayerPremiumDays(cid) > 0 or getBooleanFromString(getConfigInfo('freePremium'))))
end

function getMonthDayEnding(day)
	if(day == "01" or day == "21" or day == "31") then
		return "st"
	elseif(day == "02" or day == "22") then
		return "nd"
	elseif(day == "03" or day == "23") then
		return "rd"
	end

	return "th"
end

function getMonthString(m)
	return os.date("%B", os.time{year = 1970, month = m, day = 1})
end

function getArticle(str)
	return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a"
end

function isNumber(str)
	return tonumber(str) ~= nil
end

function doPlayerAddAddons(cid, addon)
	for i = 0, table.maxn(maleOutfits) do
		doPlayerAddOutfit(cid, maleOutfits[i], addon)
	end

	for i = 0, table.maxn(femaleOutfits) do
		doPlayerAddOutfit(cid, femaleOutfits[i], addon)
	end
end

function doPlayerWithdrawAllMoney(cid)
	return doPlayerWithdrawMoney(cid, getPlayerBalance(cid))
end

function doPlayerDepositAllMoney(cid)
	return doPlayerDepositMoney(cid, getPlayerMoney(cid))
end

function doPlayerTransferAllMoneyTo(cid, target)
	return doPlayerTransferMoneyTo(cid, target, getPlayerBalance(cid))
end

function playerExists(name)
	return getPlayerGUIDByName(name) ~= 0
end

function getTibiaTime()
	local minutes = getWorldTime()
	local hours = 0
	while (minutes > 60) do
		hours = hours + 1
		minutes = minutes - 60
	end

	return {hours = hours, minutes = minutes}
end

function doWriteLogFile(file, text)
	local f = io.open(file, "a+")
	if(not f) then
		return false
	end

	f:write("[" .. os.date("%d/%m/%Y %H:%M:%S") .. "] " .. text .. "\n")
	f:close()
	return true
end

function getExperienceForLevel(lv)
	lv = lv - 1
	return ((50 * lv * lv * lv) - (150 * lv * lv) + (400 * lv)) / 3
end

function doMutePlayer(cid, time)
	local condition = createConditionObject(CONDITION_MUTED)
	setConditionParam(condition, CONDITION_PARAM_TICKS, time * 1000)
	return doAddCondition(cid, condition)
end

function getPlayerGroupName(cid)
	return getGroupInfo(getPlayerGroupId(cid)).name
end

function getPlayerVocationName(cid)
	return getVocationInfo(getPlayerVocation(cid)).name
end

function getPromotedVocation(vid)
	return getVocationInfo(vid).promotedVocation
end

function doPlayerRemovePremiumDays(cid, days)
	return doPlayerAddPremiumDays(cid, -days)
end

function getPlayerMasterPos(cid)
	return getTownTemplePosition(getPlayerTown(cid))
end

function getHouseOwner(houseId)
	return getHouseInfo(houseId).owner
end

function getHouseName(houseId)
	return getHouseInfo(houseId).name
end

function getHouseEntry(houseId)
	return getHouseInfo(houseId).entry
end

function getHouseRent(houseId)
	return getHouseInfo(houseId).rent
end

function getHousePrice(houseId)
	return getHouseInfo(houseId).price
end

function getHouseTown(houseId)
	return getHouseInfo(houseId).town
end

function getHouseTilesCount(houseId)
	return getHouseInfo(houseId).tiles
end

function getItemNameById(itemid)
	return getItemDescriptionsById(itemid).name
end

function getItemPluralNameById(itemid)
	return getItemDescriptionsById(itemid).plural
end

function getItemArticleById(itemid)
	return getItemDescriptionsById(itemid).article
end

function getItemName(uid)
	return getItemDescriptions(uid).name
end

function getItemPluralName(uid)
	return getItemDescriptions(uid).plural
end

function getItemArticle(uid)
	return getItemDescriptions(uid).article
end

function getItemText(uid)
	return getItemDescriptions(uid).text
end

function getItemSpecialDescription(uid)
	return getItemDescriptions(uid).special
end

function getItemWriter(uid)
	return getItemDescriptions(uid).writer
end

function getItemDate(uid)
	return getItemDescriptions(uid).date
end

function getTilePzInfo(pos)
	return getTileInfo(pos).protection
end

function getTileZoneInfo(pos)
	local tmp = getTileInfo(pos)
	if(tmp.pvp) then
		return 2
	end

	if(tmp.nopvp) then
		return 1
	end

	return 0
end

function doShutdown()
	return doSetGameState(GAMESTATE_SHUTDOWN)
end

function doSummonCreature(name, pos, displayError)
	local displayError, cid = displayError or true, doCreateMonster(name, pos, displayError)
	if(not cid) then
		cid = doCreateNpc(name, pos, displayError)
	end

	return cid
end

function getOnlinePlayers()
	local tmp = getPlayersOnline()
	local players = {}
	for i, cid in ipairs(tmp) do
		table.insert(players, getCreatureName(cid))
	end

	return players
end

function getPlayerByName(name)
	local cid = getCreatureByName(name)
	return isPlayer(cid) and cid or nil
end

function isPlayer(cid)
	return isCreature(cid) and cid >= AUTOID_PLAYERS and cid < AUTOID_MONSTERS
end

function isPlayerGhost(cid)
	if(not isPlayer(cid)) then
		return false
	end

	return getCreatureCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE) or getPlayerFlagValue(cid, PLAYERFLAG_CANNOTBESEEN)
end

function isMonster(cid)
	return isCreature(cid) and cid >= AUTOID_MONSTERS and cid < AUTOID_NPCS
end

function isNpc(cid)
	return isCreature(cid) and cid >= AUTOID_NPCS
end

function doPlayerSetExperienceRate(cid, value)
	return doPlayerSetRate(cid, SKILL__LEVEL, value)
end

function doPlayerSetMagicRate(cid, value)
	return doPlayerSetRate(cid, SKILL__MAGLEVEL, value)
end

function doPlayerAddLevel(cid, amount, round)
	local experience, level = 0, getPlayerLevel(cid)
	if(amount > 0) then
		experience = getExperienceForLevel(level + amount) - (round and getPlayerExperience(cid) or getExperienceForLevel(level))
	else
		experience = -((round and getPlayerExperience(cid) or getExperienceForLevel(level)) - getExperienceForLevel(level + amount))
	end

	return doPlayerAddExperience(cid, experience)
end

function doPlayerAddMagLevel(cid, amount)
	for i = 1, amount do
		doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)) / getConfigInfo('rateMagic'))
	end
	return true
end  

function doPlayerAddSkill(cid, skill, amount, round)
	if(skill == SKILL__LEVEL) then
		return doPlayerAddLevel(cid, amount, round)
	elseif(skill == SKILL__MAGLEVEL) then
		return doPlayerAddMagLevel(cid, amount)
	end

	return doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)) / getConfigInfo('rateSkill'))
end

function getPartyLeader(cid)
	local party = getPartyMembers(cid)
	if(type(party) ~= 'table') then
		return 0
	end

	return party[1]
end

function isInParty(cid)
	return type(getPartyMembers(cid)) == 'table'
end

function isPrivateChannel(channelId)
	return channelId >= CHANNEL_PRIVATE
end

function doPlayerResetIdleTime(cid)
	return doPlayerSetIdleTime(cid, 0)
end

function doBroadcastMessage(text, class)
	local class = class or MESSAGE_STATUS_WARNING
	if(type(class) == 'string') then
		local className = MESSAGE_TYPES[class]
		if(className == nil) then
			return false
		end

		class = className
	elseif(class < MESSAGE_FIRST or class > MESSAGE_LAST) then
		return false
	end

	local players = getPlayersOnline()
	for _, pid in ipairs(players) do
		doPlayerSendTextMessage(pid, class, text)
	end

	print("> Broadcasted message: \"" .. text .. "\".")
	return true
end

function doPlayerBroadcastMessage(cid, text, class, checkFlag, ghost)
	local checkFlag, ghost, class = checkFlag or true, ghost or false, class or TALKTYPE_BROADCAST
	if(checkFlag and not getPlayerFlagValue(cid, PLAYERFLAG_CANBROADCAST)) then
		return false
	end

	if(type(class) == 'string') then
		local className = TALKTYPE_TYPES[class]
		if(className == nil) then
			return false
		end

		class = className
	elseif(class < TALKTYPE_FIRST or class > TALKTYPE_LAST) then
		return false
	end

	local players = getPlayersOnline()
	for _, pid in ipairs(players) do
		doCreatureSay(cid, text, class, ghost, pid)
	end

	print("> " .. getCreatureName(cid) .. " broadcasted message: \"" .. text .. "\".")
	return true
end

function getBooleanFromString(input)
	local tmp = type(input)
	if(tmp == 'boolean') then
		return input
	end

	if(tmp == 'number') then
		return input > 0
	end

	local str = string.lower(tostring(input))
	return (str == "yes" or str == "true" or (tonumber(str) ~= nil and tonumber(str) > 0))
end

function doCopyItem(item, attributes)
	local attributes = attributes or false

	local ret = doCreateItemEx(item.itemid, item.type)
	if(attributes) then
		if(item.actionid > 0) then
			doItemSetAttribute(ret, "aid", item.actionid)
		end
	end

	if(isContainer(item.uid)) then
		for i = (getContainerSize(item.uid) - 1), 0, -1 do
			local tmp = getContainerItem(item.uid, i)
			if(tmp.itemid > 0) then
				doAddContainerItemEx(ret, doCopyItem(tmp, true).uid)
			end
		end
	end

	return getThing(ret)
end

function doRemoveThing(uid)
	if(isCreature(uid)) then
		return doRemoveCreature(uid)
	end

	return doRemoveItem(uid)
end

function setAttackFormula(combat, type, minl, maxl, minm, maxm, min, max)
	local min, max = min or 0, max or 0
	return setCombatFormula(combat, type, -1, 0, -1, 0, minl, maxl, minm, maxm, min, max)
end

function setHealingFormula(combat, type, minl, maxl, minm, maxm, min, max)
	local min, max = min or 0, max or 0
	return setCombatFormula(combat, type, 1, 0, 1, 0, minl, maxl, minm, maxm, min, max)
end

function doChangeTypeItem(uid, subtype)
	local thing = getThing(uid)
	if(thing.itemid < 100) then
		return false
	end

	local subtype = subtype or 1
	return doTransformItem(thing.uid, thing.itemid, subtype)
end

function doSetItemText(uid, text, writer, date)
	local thing = getThing(uid)
	if(thing.itemid < 100) then
		return false
	end

	doItemSetAttribute(uid, "text", text)
	if(writer ~= nil) then
		doItemSetAttribute(uid, "writer", tostring(writer))
		if(date ~= nil) then
			doItemSetAttribute(uid, "date", tonumber(date))
		end
	end

	return true
end

function getFluidSourceType(itemid)
	local item = getItemInfo(itemid)
	return item and item.fluidSource or false
end

function getDepotId(uid)
	return getItemAttribute(uid, "depotid") or false
end

function getItemDescriptions(uid)
	local thing = getThing(uid)
	if(thing.itemid < 100) then
		return false
	end

	local item = getItemInfo(thing.itemid)
	return {
		name = getItemAttribute(uid, "name") or item.name,
		plural = getItemAttribute(uid, "pluralname") or item.plural,
		article = getItemAttribute(uid, "article") or item.article,
		special = getItemAttribute(uid, "description") or "",
		text = getItemAttribute(uid, "text") or "",
		writer = getItemAttribute(uid, "writer") or "",
		date = getItemAttribute(uid, "date") or 0
	}	
end

function getItemWeightById(itemid, count, precision)
	local item, count, precision = getItemInfo(itemid), count or 1, precision or false
	if(not item) then
		return false
	end

	if(count > 100) then
		-- print a warning, as its impossible to have more than 100 stackable items without "cheating" the count
		print('[Warning] getItemWeightById', 'Calculating weight for more than 100 items!')
	end

	local weight = item.weight * count
	--[[if(precision) then
		return weight
	end

	local t = string.explode(tostring(weight), ".")
	if(table.maxn(t) == 2) then
		return tonumber(t[1] .. "." .. string.sub(t[2], 1, 2))
	end]]--

	return weight
end

function getItemWeaponType(uid)
	local thing = getThing(uid)
	if(thing.itemid < 100) then
		return false
	end

	return getItemInfo(thing.itemid).weaponType
end

function getItemRWInfo(uid)
	local thing = getThing(uid)
	if(thing.itemid < 100) then
		return false
	end

	local item, flags = getItemInfo(thing.itemid), 0
	if(item.readable) then
		flags = 1
	end

	if(item.writable) then
		flags = flags + 2
	end

	return flags
end

function getItemLevelDoor(itemid)
	local item = getItemInfo(itemid)
	return item and item.levelDoor or false
end

function isItemStackable(itemid)
	local item = getItemInfo(itemid)
	return item and item.stackable or false
end

function isItemRune(itemid)
	local item = getItemInfo(itemid)
	return item and item.clientCharges or false
end

function isItemDoor(itemid)
	local item = getItemInfo(itemid)
	return item and item.type == 5 or false
end

function isItemContainer(itemid)
	local item = getItemInfo(itemid)
	return item and item.group == 2 or false
end

function isItemFluidContainer(itemid)
	local item = getItemInfo(itemid)
	return item and item.group == 12 or false
end

function isItemMovable(itemid)
	local item = getItemInfo(itemid)
	return item and item.movable or false
end

function isCorpse(uid)
	local thing = getThing(uid)
	if(thing.itemid < 100) then
		return false
	end

	local item = getItemInfo(thing.itemid)
	return item and item.corpseType ~= 0 or false
end

function getContainerCapById(itemid)
	local item = getItemInfo(itemid)
	if(not item or item.group ~= 2) then
		return false
	end

	return item.maxItems
end

function getMonsterAttackSpells(name)
	local monster = getMonsterInfo(name)
	return monster and monster.attacks or false
end

function getMonsterHealingSpells(name)
	local monster = getMonsterInfo(name)
	return monster and monster.defenses or false
end

function getMonsterLootList(name)
	local monster = getMonsterInfo(name)
	return monster and monster.loot or false
end

function getMonsterSummonList(name)
	local monster = getMonsterInfo(name)
	return monster and monster.summons or false
end

I understand that is the function list, probably some function missing there that is used in script. Help please.
 
im using this NPC on 8.54 and it works fine. if you want to use it for 8.54 remember to comment out the 8.6 items just add
before the item

im not really sure what is wrong sorry
 
Nice script only when i try to sell something stacked in 100 it says 'you do not have this item' i can only sell items 1 by 1.. is this normal?
 
Back
Top