• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC Npc Examples

how to do that king ask you items for the promote, like 100 iron ore for the elite knight or something?, and how to personalize the npc?, like to put, if the voc id is 4 change voc id to 11????, i make new npc that gives you custom vocations if you are the correct =P, plz help!

Please make an new thread in lua section for serveral reasons.

-More people wil vieuw the thread
-More people might need it
-u will get more help there
 
Moker, I would like You to fix the boats in the npc system, because players with free can travel too and add check if attacked other player. :P

Hope you can make it =)
 
Mokerhamer I was wonderin if you could help me with making a Promotion npc that uses an addon system... like the king says bring me 5 dragon scales and 50 wolf paws to be promoted, also you have to be lvl 20
 
Code:
-- OTServ event handling functions start
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
-- OTServ event handling functions end


-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'witch land'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to witch Land for 0 gold coins?'})
	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 30, cost = 0, destination = {x=838, y=973, z=7} })
	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

local travelNode = keywordHandler:addKeyword({'Snow City'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel back to the City for 0 gold coins?'})
	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 30, cost = 0, destination = {x=998, y=1124, z=7} })
	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

keywordHandler:addKeyword({'go'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to witch Land or to the Snow City for just 0 gold.'})

-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())

when i say witch land the npc respand but when i say snow city the npc not respand why?

Help me it will be very nice
 
Code:
-- OTServ event handling functions start
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
-- OTServ event handling functions end


-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'witch land'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to witch Land for 0 gold coins?'})
	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 30, cost = 0, destination = {x=838, y=973, z=7} })
	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

local travelNode = keywordHandler:addKeyword({'Snow City'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel back to the City for 0 gold coins?'})
	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 30, cost = 0, destination = {x=998, y=1124, z=7} })
	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

keywordHandler:addKeyword({'go'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to witch Land or to the Snow City for just 0 gold.'})

-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())

when i say witch land the npc respand but when i say snow city the npc not respand why?

Help me it will be very nice

i will look at it in the morning since i need to go to bed, i need to work tomorrow and i need to wake up 4:30 AM =( and i'll be back at 6:00PM

anywais does it give any error's in the console?



Edit*)
I found the bug


change
Snow City
to
snow city

that should fix it =) Never use CAPITAL letters.
 
Last edited:
isItemStackable(itemid) was changed and is not changed in the npcsystem distributed with tfs. there are some other npc issues floating about. but with a little tinkering you can sort these issues with relative ease
 
I need npc that start the quest:
1. Go to magic statue and get item xxxx id
2. Come back to me and i give u reward( tttt id)
 
@ Rexibol:
To kate.xml:
Code:
<npc name="Kate" script="data/npc/scripts/furniture.lua" autowalk="25" floorchange="0" access="3" level="1" maglevel="1">
	<health now="150" max="150"/>
	<look type="142" head="114" body="0" legs="95" feet="114" corpse="2212" addons="3"/>
	<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 100 gold pieces." />
		<parameter key="shop_buyable" value="wooden chair,3901,15;sofa chair,3902,55;red cushioned chair,3903,40;green cushioned chair,3904,40;tusk chair,3905,25;ivory chair,3906,25;big table,3909,30;square table,3910,25;round table,3911,25;small table,3912,20;stone table,3913,30;tusk table,3914,25;bamboo table,3919,25;potted flower,3928,5;indoor plant,3929,8;christmas tree,3931,50;large trunk,3938,10;drawer,3921,18;dresser,3932,25;locker,3934,30;trough,3935,7;box,3915,10;birdcage,3918,50;harp,3917,50;piano,3926,200;globe,3927,50;pendelum clock,3933,75;table lamp,3937,35;blue tapestry,1872,25;green tapestry,1860,25;orange tapestry,1866,25;pink tapestry,1857,25;red tapestry,1869,25;white tapestry,1880,25;yellow tapestry,1863,25;small purple pillow,1678,20;small green pillow,1679,20;small red pillow,1680,20;small blue pillow,1681,20;small orange pillow,1683,20;small turquiose pillow,1684,20;small white pillow,1684,20;heart pillow,1685,30;purple pillow,1678,25;green pillow,1679,25;red pillow,1680,25;blue pillow,1681,orange pillow,1682,25;turqoise pillow,25;white pillow,1684,25;round blue pillow,1690,25;round red pillow,1691,25;round purple pillow,1692,25;round turquiose pillow,1693,25;coal basin,3908,25" />
	</parameters>
</npc>

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



-- OTServ event handling functions start
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
-- OTServ event handling functions 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(15gp), sofa(55gp), red cushioned(40gp), green cushioned(40gp), tusk(25gp) and ivory(25gp) chairs.'})
keywordHandler:addKeyword({'tables'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell big(30gp), square(25gp), round(25gp), small(20gp), stone(30gp), tusk(25gp), bamboo(25gp) tables.'})
keywordHandler:addKeyword({'flowers'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell potter flowers(5gp) and indoor plants(8), also christmas trees(50gp).'})
keywordHandler:addKeyword({'containers'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell large trunks(10gp), boxes(10gp), drawers(18gp), dressers(25gp), lockers(30gp) and troughs(7gp).'})
keywordHandler:addKeyword({'more'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell birdcages(50gp), coal basins(25gp), harps(50gp), pianos(200gp), globes(50gp), pendelum clocks(75gp) and table lamps(35gp).'})

keywordHandler:addKeyword({'pillows'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell small pillows(20gp), round pillows(25gp), square pillows(25gp) and tapestries(25gp). I also sell heart pillows(30gp).'})
keywordHandler:addKeyword({'tapestries'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell blue, green, orange, pink, red, white and yellow tapestries for 25 gp each.'})
keywordHandler:addKeyword({'small'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell small blue, red, green, purple, orange, turquoise and white pillows for 20 gp each.'})
keywordHandler:addKeyword({'round'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell round purple, red, blue and turquoise pillows for 25gp each.'})
keywordHandler:addKeyword({'sqaure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell purple, green, red, blue, orange, turqoise and white pillows for 25gp each.'})

-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
 
Back
Top