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

Rune NPC

Randyf00

New Member
Joined
Aug 11, 2008
Messages
54
Reaction score
0
My rune npc sells double of everything.

For example you buy 4 sd runes he gives you 8.

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'snakebite rod', 'SBR'}, 2182, 100, 1, 'snakebite rod')
shopModule:addBuyableItem({'moonlight rod', 'MLR'}, 2186, 400, 1, 'moonlight rod')
shopModule:addBuyableItem({'necrotic rod', 'NR'}, 2185, 700, 1, 'necrotic rod')
shopModule:addBuyableItem({'terra rod', 'TR'}, 2181, 1000, 1, 'terra rod')
shopModule:addBuyableItem({'springsprout rod', 'SR'}, 8912, 25000, 1, 'springsprout rod')
shopModule:addBuyableItem({'underworld rod', 'UR'}, 8910, 500000, 1, 'underworld rod')
shopModule:addBuyableItem({'blessed rod', 'BR'}, 7429, 1000000, 1, 'blessed rod')
shopModule:addBuyableItem({'queens rod', 'QR'}, 7410, 2500000, 1, 'queens rod')
shopModule:addBuyableItem({'hailstorm rod', 'HSR'}, 2183, 1200, 1, 'hailstorm rod')
shopModule:addBuyableItem({'wand of vortex', 'WOV'}, 2180, 100, 1, 'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'WODB'}, 2191, 400, 1, 'wand of dragonbreath')
shopModule:addBuyableItem({'wand of decay', 'WOD'}, 2188, 700, 1, 'wand of decay')
shopModule:addBuyableItem({'wand of cosmic energy', 'WOE'}, 2189, 1000, 1, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of inferno', 'WOI'}, 2187, 1200, 1, 'wand of inferno')
shopModule:addBuyableItem({'wand of starstorm', 'WOST'}, 8820, 250000, 1, 'wand of starstorm')
shopModule:addBuyableItem({'wand of voodoo', 'WOVD'}, 8922, 500000, 1, 'wand of voodoo')
shopModule:addBuyableItem({'lunar wand', 'LW'}, 7424, 1000000, 1, 'lunar wand')
shopModule:addBuyableItem({'wand of shadow', 'WOS'}, 7451, 250000, 1, 'wand of shadow')
shopModule:addBuyableItem({'ultimate health potion', 'uhp'}, 8473, 310, 'ultimate health potion')
shopModule:addBuyableItem({'great health potion', 'ghp'}, 7591, 190, 'great health potion')
shopModule:addBuyableItem({'strong health potion', 'shp'}, 7588, 100, 'strong health potion')
shopModule:addBuyableItem({'health potion', 'hp'}, 7618, 45, 'health potion')
shopModule:addBuyableItem({'great spirit potion', 'gsp'}, 8472, 190, 'great spirit potion')
shopModule:addBuyableItem({'great mana potion', 'gmp'}, 7590, 120, 'great mana potion')
shopModule:addBuyableItem({'strong mana potion', 'smp'}, 7589, 80, 'strong mana potion')
shopModule:addBuyableItem({'mana potion', 'mp'}, 7620, 50, 'mana potion')
shopModule:addBuyableItem({'light wand', 'lightwand'}, 2163, 500, 'magic light wand')
shopModule:addBuyableItem({'heavy magic missile', 'hmm'}, 2311, 1300, 20, 'heavy magic missile rune')
shopModule:addBuyableItem({'great fireball', 'gfb'}, 2304, 1500, 20, 'great fireball rune')
shopModule:addBuyableItem({'explo', 'xpl'}, 2313, 1800, 100, 'explosion rune')
shopModule:addBuyableItem({'ultimate healing', 'uh'}, 2273, 750, 100, 'ultimate healing rune')
shopModule:addBuyableItem({'sudden death', 'sd'}, 2268, 2000, 100, 'sudden death rune')
shopModule:addBuyableItem({'blank', 'rune'}, 2260, 10, 'blank rune')
shopModule:addBuyableItem({'spellbook'}, 2175, 150, 'spellbook')
shopModule:addBuyableItem({'energy ring', 'rune'}, 2296, 10000, 5, 'energy ring rune')
shopModule:addBuyableItem({'charge', 'rune'}, 2295, 5000, 10, 'charge rune')
shopModule:addBuyableItem({'eternal fire', 'rune'}, 2300, 50000, 2, 'eternal fire rune')
shopModule:addBuyableItem({'shuriken bomb', 'rune'}, 2263, 50000, 2, 'shuriken bomb')

npcHandler:addModule(FocusModule:new())



Any help please?
 
Oh alright I will take a look



<?xml version="1.0" encoding="UTF-8"?>
<npc name="Eryn" script="data/npc/scripts/runes.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="130" head="39" body="122" legs="125" feet="57" addons="0"/>
<parameters>
<parameter key="message_greet" value="SUP |PLAYERNAME|. I sell runes, potions, wands and rods."/>
<parameter key="message_needmoremoney" value="You do not have enough money."/>
<parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you? Get out of here!"/>
<parameter key="module_shop" value="1" />
<parameter key="shop_buyable" value="snakebite rod,2182,500;moonlight rod,2186,400;necrotic rod,2185,800;terra rod,2181,1000;springsprout rod,8912,10000;underworld,8910,50000;blessed rod,7429,100000;hailstorm rod,2183,5000;wand of vortex,2180,100;wand of dragonbreath,2191,400;wand of decay,2188,700;wand of cosmic energy,2189,1000;wand of inferno,2187,5000;wand of starstorm,8920, 10000;wand of voodoo,8922,50000;lunar wand,7424,100000;wand of shadow,7451,2500000;ultimate health potion,8473,310;great health potion,7591,190;strong health potion,7588,100;health potion,7618,45;great spirit potion,8472,190;great mana potion,7590,120;strong mana potion,7589,80;mana potion,7620,50;light wand,2163,500;heavy magic missile,2311,300;great fireball,2304,500;explo,2313,800;ultimate healing,2273,700;blank,2260,10;spellbook,2175,150;energy ring,2296,10000;charge,2295,5000;eternal fire,2300,100000;shuriken bomb,2263,1000000"/>

<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="runes;potions;wands;rods" />


<parameter key="keyword_reply1" value="I sell all original runes plus a couple new ones, energy ring, eternal fire, charge, shuriken bomb." />
<parameter key="keyword_reply2" value="I sell lots of potions just ask me which one." />
<parameter key="keyword_reply3" value="I sell all normal wands, and the custom ones are wand of starstorm, wand of voodoo, lunar wand, wand of shadow. The custom wands are expensive!" />
<parameter key="keyword_reply4" value="I sell all normal wands, and the custom ones are springsprout rod, underworld rod, blessed rod, queens rod. The custom rods are expensive!" />

</parameters>
</npc>
 
You need to choose between using the script or the xml file.

The xml file have the action to sell a SD and the script too so choose one.
 
Indeed, so what you could easily do is to change the script in your NPC.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Eryn" script="data/npc/scripts/[COLOR=Red][B]default.lua[/B][/COLOR]" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="130" head="39" body="122" legs="125" feet="57" addons="0"/>
    <parameters>
        <parameter key="message_greet" value="SUP |PLAYERNAME|. I sell runes, potions, wands and rods."/>
        <parameter key="message_needmoremoney" value="You do not have enough money."/>
        <parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you? Get out of here!"/>
        <parameter key="module_shop" value="1" />
<parameter key="shop_buyable" value="snakebite rod,2182,500;moonlight rod,2186,400;necrotic rod,2185,800;terra rod,2181,1000;springsprout rod,8912,10000;underworld,8910,50000;blessed rod,7429,100000;hailstorm rod,2183,5000;wand of vortex,2180,100;wand of dragonbreath,2191,400;wand of decay,2188,700;wand of cosmic energy,2189,1000;wand of inferno,2187,5000;wand of starstorm,8920, 10000;wand of voodoo,8922,50000;lunar wand,7424,100000;wand of shadow,7451,2500000;ultimate health potion,8473,310;great health potion,7591,190;strong health potion,7588,100;health potion,7618,45;great spirit potion,8472,190;great mana potion,7590,120;strong mana potion,7589,80;mana potion,7620,50;light wand,2163,500;heavy magic missile,2311,300;great fireball,2304,500;explo,2313,800;ultimate healing,2273,700;blank,2260,10;spellbook,2175,150; energy ring,2296,10000;charge,2295,5000;eternal fire,2300,100000;shuriken bomb,2263,1000000"/>
 
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="runes;potions;wands;rods" />
 
 
<parameter key="keyword_reply1" value="I sell all original runes plus a couple new ones, energy ring, eternal fire, charge, shuriken bomb." />
    <parameter key="keyword_reply2" value="I sell lots of potions just ask me which one." />
<parameter key="keyword_reply3" value="I sell all normal wands, and the custom ones are wand of starstorm, wand of voodoo, lunar wand, wand of shadow. The custom wands are expensive!" />
<parameter key="keyword_reply4" value="I sell all normal wands, and the custom ones are springsprout rod, underworld rod, blessed rod, queens rod. The custom rods are expensive!" />
 
    </parameters>
</npc>
And then remove your scripts/runes.lua file, or just leave it. That's up to you :)
 
Simply use my code in your XML file, which will just put the runes.lua aside by using default.lua instead. And yes, it will still sell the runes.
 
Remember that you need your default.lua or runes.lua
like this:

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

npcHandler:addModule(FocusModule:new())
 
Back
Top