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

{Request} [NPC] Selling for non-gold currency

Gale

The Crooked Fate
Joined
Jun 7, 2008
Messages
56
Reaction score
0
This may be very simple, but i'm looking for an npc script that will sell his items for gold nuggets instead of gold/platinum/crystal coins. I prefer if he would use the trading window also.

Ex. NPC will sell a martini for 30 gold nuggets. (OUTRAGEOUS?!?!?!)

Possible bugs to watch out for:
Buying with backpacks, i dont want him to spend 20 gold nuggets on a backpack

This would help out a lot!

Thanks+ rep to whoever can help me!!!
 
Last edited:
Sure this is from a furniture npc

Here is the lola.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Lola" script="furniture.lua" walkinterval="2000" floorchange="0">
	<health now="150" max="150"/>
	<look type="142" head="114" body="0" legs="95" feet="114" corpse="2212"/>
	<parameters>
		<parameter key="module_shop" value="1"/>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell chairs, tables, plants, containers, pillows, tapestries and more. Everything for 500 gold pieces, just {trade}."/>
		<parameter key="shop_buyable" value="wooden chair,3901,500;sofa chair,3902,500;red cushioned chair,3903,500;green cushioned chair,3904,500;tusk chair,3905,500;ivory chair,3906,500;water-pipe,3907,500;coal basin,3908,500;big table,3909,500;square table,3910,500;round table,3911,500;small table,3912,500;stone table,3913,500;tusk table,3914,500;chest,3915,500;barrel,3916,500;harp,3917,500;bird cage,3918,500;bamboo table,3919,500;bamboo drawer,3920,500;drawer,3921,500;exotic flower,3922,500;potted flower,3923,500;flower bowl,3924,500;chest,3925,500;piano,3926,500;globe,3927,500;rocking chair,3928,500;indoor plant,3929,500;crate,3930,500;christmas tree,3931,500;dresser,3932,500;pendelum clock,3933,500;locker,3934,500;trough,3935,500;time table,3936,500;table lamp,3937,500;bookcase,3938,500;box,5086,500;box2,5087,500;barrel2,5088,500;big flowerpot,6114,500;large amphora,6115,500;tree stump,6372,500;mirror,6373,500;large trunk,7503,500;goldfish bowl,7700,500;tree stump2,7960,500;cuckoo clock,7961,500;telescope,7962,500;furnace,8692,500;blue tapestry,1872,500;green tapestry,1860,500;orange tapestry,1866,500;pink tapestry,1857,500;red tapestry,1869,500;white tapestry,1880,500;yellow tapestry,1863,500;small purple pillow,1678,500;small green pillow,1679,500;small red pillow,1680,500;small blue pillow,1681,500;small orange pillow,1683,500;small turquiose pillow,1684,500;small white pillow,1685,500;heart pillow,1685,500;blue pillow,1686,500;red pillow,1687,500;green pillow,1688,500;yellow pillow,1689,500;round blue pillow,1690,500;round red pillow,1691,500;round purple pillow,1692,500;round turquiose pillow,1693,500;oval mirror,1845,750;round mirror,1848,750;edged mirror,1851,750;green bed,7904,1000;red bed,7905,1000;yellow bed,7906,1000;bed removal,7907,1000;wooden stake,5941,10000;" />
	</parameters>
</npc>

And here is the funiture.lua
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

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
keywordHandler:addKeyword({'chairs'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell wooden, sofa, red cushioned, green cushioned, tusk and ivory chairs.'})
keywordHandler:addKeyword({'tables'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell big, square, round, small, stone, tusk, bamboo tables.'})
keywordHandler:addKeyword({'plants'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell pink and green flowers, also christmas trees.'})
keywordHandler:addKeyword({'furniture'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell large trunks, boxes, drawers, dressers, lockers and troughs.'})
keywordHandler:addKeyword({'more'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell coal basins, birdcages, harps, pianos, globes, clocks and lamps.'})
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell blue, green, orange, pink, red, white and yellow tapestries.'})
keywordHandler:addKeyword({'small'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell small purple, small green, small red, small blue, small orange, small turquiose and small white pillows.'})
keywordHandler:addKeyword({'round'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell round blue, round red, round purple and round turquiose pillows.'})
keywordHandler:addKeyword({'square'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell blue, red, green and yellow pillows.'})
keywordHandler:addKeyword({'pillows'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell heart, small, sqare and round pillows.'})

npcHandler:addModule(FocusModule:new())

Hope this helps!
 
:D
One of my first scripts (8.1):
Lua:
local focus = 0
local talk_start = 0
local target = 0
local days = 0
local gold = 2157   --(nugget)

local mpa = 2472
local bolt = 6529
local money = 2160
local legs = 2495
local bow = 7438
local arrow = 2352
local armor = 2494
local star = 7368
local herb = 2798


function onThingMove(creature, thing, oldpos, oldstackpos)

end

function onCreatureAppear(creature)

end

function onCreatureDisappear(cid, pos)
  	if focus == cid then
          selfSay('Good bye then.')
          focus = 0
          talk_start = 0
  	end
end

function onCreatureTurn(creature)

end

function msgcontains(txt, str)
  	return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))

end


function onCreatureSay(cid, type, msg)
  	msg = string.lower(msg)

  	if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
 		selfSay('Hello ' .. creatureGetName(cid) .. '! I sell rare Items for Gold Nuggeds! Say "Items" and i tell you what Items i Sell.')
 		focus = cid
 		talk_start = os.clock()

	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
  		selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

  	elseif focus == cid then
		talk_start = os.clock()
---------------------------------------------------------------------------------------------------
		if msgcontains(msg, 'items') or msgcontains(msg, 'item') then
						selfSay('All Items that I sell are on the shield on the Wall.')
---------------------------------------------------------------------------------------------------			
		elseif msgcontains(msg, 'buy magic plate armor') or msgcontains(msg, 'buy mpa') then
					if doPlayerRemoveItem(cid, gold, 5) == TRUE then
						doPlayerAddItem(cid, mpa, 1)
						selfSay('Here is Your Item!')
					else 
						selfSay('You need 5 Gold Nuggets!')
					end
----				
		elseif msgcontains(msg, 'infernal bolt') then
					if doPlayerRemoveItem(cid, gold, 5) == TRUE then
						doPlayerAddItem(cid, bolt, 1)
						selfSay('Here is Your Item!')
					else 
						selfSay('You need 5 Gold Nuggets!')
				        end
----				
		elseif msgcontains(msg, 'golden bow') then
					if doPlayerRemoveItem(cid, gold, 5) == TRUE then
						doPlayerAddItem(cid, bow, 1)
						selfSay('Here is Your Item!')
					else 
						selfSay('You need 5 Gold Nuggets!')
				        end
----				
		elseif msgcontains(msg, 'demon legs') then
					if doPlayerRemoveItem(cid, gold, 2) == TRUE then
						doPlayerAddItem(cid, legs, 1)
						selfSay('Here is Your Item!')
					else 
						selfSay('You need 2 Gold Nuggets!')
				        end
----				
		elseif msgcontains(msg, 'crystal arrow') then
					if doPlayerRemoveItem(cid, gold, 8) == TRUE then
						doPlayerAddItem(cid, arrow, 1)
						selfSay('Here is Your Item!')
					else 
						selfSay('You need 8 Gold Nuggets!')
				        end
----				
		elseif msgcontains(msg, 'demon armor') then
					if doPlayerRemoveItem(cid, gold, 1) == TRUE then
						doPlayerAddItem(cid, armor, 1)
						selfSay('Here is Your Item!')
					else 
						selfSay('You need 1 Gold Nugget!')
				        end
----				
		elseif msgcontains(msg, 'assasin star') then
					if doPlayerRemoveItem(cid, gold, 1) == TRUE then
						doPlayerAddItem(cid, star, 100)
						selfSay('Here is Your Item!')
					else 
						selfSay('You need 1 Gold Nugget!')
				        end
----				
		elseif msgcontains(msg, 'blood herb') or msgcontains(msg, 'blood herbs') or msgcontains(msg, '100 blood herb') or msgcontains(msg, '100 blood herb') then
					if doPlayerRemoveItem(cid, gold, 1) == TRUE then
						doPlayerAddItem(cid, herb, 100)
						selfSay('Here is Your Items!')
					else 
						selfSay('You need 1 Gold Nugget!')
				        end
---------------------------------------------------------------------------------------------------	
  		elseif msgcontains(msg, 'bye')  and getDistanceToCreature(cid) < 4 then
  			selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
  			focus = 0
  			talk_start = 0
  		end
  	end
end


function onCreatureChangeOutfit(creature)

end

function onThink()
	doNpcSetCreatureFocus(focus)
  	if (os.clock() - talk_start) > 30 then
  		if focus > 0 then
  			selfSay('Next Please...')
  		end
  			focus = 0
  	end
 	if focus ~= 0 then
 		if getDistanceToCreature(focus) > 5 then
 			selfSay('Good bye then.')
 			focus = 0
 		end
 	end
end

Regards,
Shawak
 
Back
Top