• 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

keffaly

AlodrasRevenge.tk
Joined
May 22, 2011
Messages
139
Reaction score
2
Location
Computer.
how do i make a NPC sell a item its not selling already for a certain ammount of money?
 
data/npcs/npcname
for example Frodo:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Frodo" script="data/npc/scripts/Frodo.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="58" body="68" legs="109" feet="131" addons="0"/>
	<parameters>
		<parameter key="module_shop" value="1" />
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell all kind of food, say {trade} to see what I got to offer!" />
		<parameter key="shop_buyable" value="[COLOR="#FF0000"]dragon ham,2672,20;[/COLOR]brown mushroom,2789,10;bread,2689,4;ham,2671,8;cheese,2696,4;meat,2666,5" />
	</parameters>
</npc>
dragon ham,2672,20;
item name,item id,cost
REp me if i helped
 
I will rep you if you give me a code for Malak to sell my custom manarune, Alodras Manarune
Lol. thats what i needed to do is for malak to sell my custom item alodras manarune
 
oki dokey

Here it is:


<npc name="Malak" script="data/npc/scripts/runes.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="130" head="132" body="116" legs="116" feet="76" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell runes, fluids, wands and rods, to buy mana potions just say buy mana fluid, its a bit different on this server its mana fluid not potion :)." />
<parameter key="message_needmoremoney" value="You do not have enough money." />
<parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you?" />
</parameters>
</npc>

And heres the data/npc/scripts/runes.lua:


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



-- OTServ event handling functions start
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
-- OTServ event handling functions end

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

shopModule:addBuyableItem({'light wand', 'lightwand'}, 2163, 500, 'magic light wand')
shopModule:addBuyableItem({'mana fluid', 'manafluid'}, 2006, 100, 7, 'mana fluid')
shopModule:addBuyableItem({'life fluid', 'lifefluid'}, 2006, 80, 10, 'life fluid')

shopModule:addBuyableItem({'heavy magic missile', 'hmm'}, 2311, 125, 10, 'heavy magic missile rune')
shopModule:addBuyableItem({'great fireball', 'gfb'}, 2304, 180, 4, 'great fireball rune')
shopModule:addBuyableItem({'explo', 'xpl'}, 2313, 250, 6, 'explosion rune')
shopModule:addBuyableItem({'ultimate healing', 'uh'}, 2273, 175, 2, 'ultimate healing rune')
shopModule:addBuyableItem({'sudden death', 'sd'}, 2268, 325, 2, 'sudden death rune')
shopModule:addBuyableItem({'blank', 'rune'}, 2260, 10, 'blank rune')

shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 2187, 15000, 'wand of inferno')
shopModule:addBuyableItem({'wand of plague', 'plague'}, 2188, 5000, 'wand of plague')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 10000, 'explosion rune')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 2190, 500, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 1000, 'wand of dragonbreath')

shopModule:addBuyableItem({'quagmire rod', 'quagmire'}, 2181, 10000, 'quagmire rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 2182, 500, 'snakebite rod')
shopModule:addBuyableItem({'tempest rod', 'tempest'}, 2183, 15000, 'tempest rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'}, 2185, 5000, 'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 2186, 1000, 'moonlight rod')

npcHandler:addModule(FocusModule:new())
 
Last edited by a moderator:
just easy bro u have to learn
down this shopModule:addBuyableItem({'heavy magic missile', 'hmm'}, 2311, 125, 10, 'heavy magic missile rune')
copy the line and paste but make some changes
shopModule:addBuyableItem({'put here runes name ', 'here the simple nickname like mr'}, id of mana rune, how much it costs, how much charges, 'also manarune name')

and if u still confused say the manarune name and how much cost
 
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- OTServ event handling functions start
function onCreatureAppear(cid)	 npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
-- OTServ event handling functions end

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

shopModule:addBuyableItem({'light wand', 'lightwand'}, 2163, 500, 'magic light wand')
shopModule:addBuyableItem({'mana fluid', 'manafluid'}, 2006, 100, 7, 'mana fluid')
shopModule:addBuyableItem({'life fluid', 'lifefluid'}, 2006, 80, 10,	'life fluid')

shopModule:addBuyableItem({'heavy magic missile', 'hmm'}, 2311, 125, 10,	'heavy magic missile rune')
shopModule:addBuyableItem({'great fireball', 'gfb'}, 2304, 180, 4, 'great fireball rune')
shopModule:addBuyableItem({'explo', 'xpl'}, 2313, 250, 6, 'explosion rune')
shopModule:addBuyableItem({'ultimate healing', 'uh'}, 2273, 175, 2, 'ultimate healing rune')
shopModule:addBuyableItem({'sudden death', 'sd'}, 2268, 325, 2, 'sudden death rune')
shopModule:addBuyableItem({'blank', 'rune'}, 2260, 10, 'blank rune')
shopModule:addBuyableItem({'Manarune', 'Alodras'}, 2306, 1000, 'Alodras ManaRune')

shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 2187, 15000, 'wand of inferno')
shopModule:addBuyableItem({'wand of plague', 'plague'}, 2188, 5000, 'wand of plague')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 10000, 'explosion rune')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 2190, 500, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 1000, 'wand of dragonbreath')

shopModule:addBuyableItem({'quagmire rod', 'quagmire'}, 2181, 10000, 'quagmire rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 2182, 500, 'snakebite rod')
shopModule:addBuyableItem({'tempest rod', 'tempest'}, 2183, 15000, 'tempest rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'}, 2185, 5000, 'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 2186, 1000, 'moonlight rod')

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