Launian
Tsuki~
- Joined
- Jul 7, 2008
- Messages
- 34
- Reaction score
- 1
Well, I left OT's for a while (since 7.9), so there might be some errors, but I'll post some NPC's that I've been doing/modifying. If you guys find them usefull, great, and if you can give me some tips to make them simplier, even better 
Jewerly trader (including gold ingots and nuggets):
So again, if you have any advice, more than welcome. I'll post some more later, wanting to make an ring engraver and a backpack seller.
Laun~

Jewerly trader (including gold ingots and nuggets):
Amulet seller (with all the amulets that are buyable from NPC's):christine.xml
gems.luaCode:<?xml version="1.0" encoding="UTF-8"?> <npc name="Christine" script="data/npc/scripts/gems.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="140" head="115" body="108" legs="124" feet="114" addons="2"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. I'm a jewerly trader, to I buy and sell all kinds of gems."/> </parameters> </npc>
LUA:local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local shopModule = ShopModule:new() npcHandler:addModule(shopModule) -- Buyables -- Pearls shopModule:addBuyableItem({''}, 2144, 1000, 'black pearl') shopModule:addBuyableItem({''}, 2143, 1000, 'white pearl') -- Small gems shopModule:addBuyableItem({''}, 2150, 800, 'small amethyst') shopModule:addBuyableItem({''}, 2145, 800, 'small diamond') shopModule:addBuyableItem({''}, 2149, 800, 'small emerald') shopModule:addBuyableItem({''}, 2147, 800, 'small ruby') shopModule:addBuyableItem({''}, 2146, 800, 'small sapphire') shopModule:addBuyableItem({''}, 9970, 800, 'small topaz') -- Big Gems shopModule:addBuyableItem({''}, 2158, 1000000, 'blue gem') shopModule:addBuyableItem({''}, 2155, 1000000, 'green gem') shopModule:addBuyableItem({''}, 2156, 500000, 'red gem') shopModule:addBuyableItem({''}, 2153, 1000000, 'violet gem') shopModule:addBuyableItem({''}, 2154, 1000000, 'yellow gem') -- Gold Pieces shopModule:addBuyableItem({''}, 2159, 500, 'scarab coin') shopModule:addBuyableItem({''}, 9971, 500000, 'gold ingot') shopModule:addBuyableItem({''}, 2157, 100000, 'gold nugget') --Sellables -- Perls shopModule:addSellableItem({''}, 2144, 600, 'black pearl') shopModule:addSellableItem({''}, 2143, 500, 'white pearl') -- Small gems shopModule:addSellableItem({''}, 2150, 300, 'small amethyst') shopModule:addSellableItem({''}, 2145, 300, 'small diamond') shopModule:addSellableItem({''}, 2149, 300, 'small emerald') shopModule:addSellableItem({''}, 2147, 300, 'small ruby') shopModule:addSellableItem({''}, 2146, 300, 'small sapphire') shopModule:addSellableItem({''}, 9970, 300, 'small topaz') -- Big Gems shopModule:addSellableItem({''}, 2158, 100000, 'blue gem') shopModule:addSellableItem({''}, 2155, 100000, 'green gem') shopModule:addSellableItem({''}, 2156, 25000, 'red gem') shopModule:addSellableItem({''}, 2153, 100000, 'violet gem') shopModule:addSellableItem({''}, 2154, 100000, 'yellow gem') -- Gold Pieces shopModule:addSellableItem({''}, 2159, 100, 'scarab coin') shopModule:addSellableItem({''}, 9971, 25000, 'gold ingot') shopModule:addSellableItem({''}, 2157, 50000, 'gold nugget') npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Well, that's about it for now. I guess you all know where you got to put themDufi.xml
amulets.luaCode:<?xml version="1.0" encoding="UTF-8"?> <npc name="Dufi" script="data/npc/scripts/amulets.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="80" head="0" body="0" legs="0" feet="0" addons="0"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. I sell aols, as well as another amulets. Just say {trade} to browse my wares."/> </parameters> </npc>
LUA:local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local shopModule = ShopModule:new() npcHandler:addModule(shopModule) shopModule:addBuyableItem({''}, 2173, 10000, 'amulet of loss') shopModule:addBuyableItem({''}, 2161, 500, 100, 'strange talisman') shopModule:addBuyableItem({''}, 2170, 500, 200, 'silver amulet') shopModule:addBuyableItem({''}, 2171, 5000, 'platinum amulet') shopModule:addBuyableItem({''}, 2172, 500, 200, 'bronze amulet') shopModule:addBuyableItem({''}, 2197, 7000, 5, 'stone skin amulet') shopModule:addBuyableItem({''}, 2198, 2000, 100, 'elven amulet') shopModule:addBuyableItem({''}, 2200, 1000, 250, 'protection amulet') shopModule:addBuyableItem({''}, 2201, 500, 100, 'dragon necklace') shopModule:addBuyableItem({''}, 2199, 500, 100, 'garlick necklace') npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())

Laun~