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

How to add a BUYABLE item?

morov

New Member
Joined
Jul 5, 2009
Messages
57
Reaction score
0
I am using Mystic Spirit 0.2.4 and wanna add aol and rings to djinn shop npc, how to do it?

repp ofc!!!!! :thumbup:
 
In the NPC script add..

shopModule:addBuyableItem({'amulet of loss'}, 2173, 30000, 'amulet of loss')
shopModule:addBuyableItem({'time ring'}, 2169, 4000, 'time ring')
shopModule:addBuyableItem({'life ring'}, 2168, 2000, 'life ring')
shopModule:addBuyableItem({'energy ring'}, 2167, 4000, 'energy ring')
shopModule:addBuyableItem({'stealth ring'}, 2165, 6000, 'stealth ring')
shopModule:addBuyableItem({'might ring'}, 2164, 6000, 'might ring')

Something like that
 
In the NPC script add..

shopModule:addBuyableItem({'amulet of loss'}, 2173, 30000, 'amulet of loss')
shopModule:addBuyableItem({'time ring'}, 2169, 4000, 'time ring')
shopModule:addBuyableItem({'life ring'}, 2168, 2000, 'life ring')
shopModule:addBuyableItem({'energy ring'}, 2167, 4000, 'energy ring')
shopModule:addBuyableItem({'stealth ring'}, 2165, 6000, 'stealth ring')
shopModule:addBuyableItem({'might ring'}, 2164, 6000, 'might ring')

Something like that

Thanks imma try..

PS How I can give you repp? xD
 
In the little box next to my post where is has my username and post count, there is an icon that looks like two people, one red and one green. Click it.
 
Should I add it just after the Sellable items?

Since I made like new line..

--

local

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




but when I putted server online there was no more that npc xD

and couldnt summon one..

Got pic where to place it?
 
Last edited:
Well, dont know if there comes any errors in one part atleast not when loading npc's or scripts..

That one part goes uber fast text and cant scroll all way that up :S

there comes an error when I try to make it with /s djinn shop...

Lua Script Error: [Npc inferface]
data/npc/scripts/Djinn.lua

data/npc/lib/npcsystem/modules.lua:764: attempt to call global 'getItemNameById' (a nil value)
[Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/Djinn.lua

data/npc/scripts/automatic1.lua:7: unexpected symbol near 'local'


I can't find anything unexpected symbol near 'local'... :S
 
Does anyone here, or you have a npc for 0.2.4 that Buys something? maybe you could post the code of that npc and I only change the id's from it?
Please... :(
 
Can you post the script you are using so we can debugg it for you?


This is the one I use on my server.

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

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

shopModule:addBuyableItem({'amulet of loss'}, 2173, 30000, 'amulet of loss')
shopModule:addBuyableItem({'bronze amulet'}, 2172, 300, 'bronze amulet') 
shopModule:addBuyableItem({'silver amulet'}, 2170, 300, 'silver amulet') 

shopModule:addBuyableItem({'time ring'}, 2169, 4000, 'time ring') 
shopModule:addBuyableItem({'life ring'}, 2168, 2000, 'life ring') 
shopModule:addBuyableItem({'energy ring'}, 2167, 4000, 'energy ring') 
shopModule:addBuyableItem({'stealth ring'}, 2165, 6000, 'stealth ring') 
shopModule:addBuyableItem({'might ring'}, 2164, 6000, 'might ring') 

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