• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved NPCs..

Linkz

New Member
Joined
Aug 1, 2013
Messages
12
Reaction score
0
I've been messing around with my NPC files and trying to get them to work. So far I've gotten a banker, and a ship captain (sort of..), and an equipment trader.

I keep trying different stuff but I can't seem to get other NPC's to show up, and I also can't figure out how to make an NPC Sell items.. just buy them from me. I've looked at tutorials and what not and have of course trial and error'd with the other scripts but I'm not getting anywhere.. when I do get close, though, the npc stops responding after you say 'yes' to it's questions.
 
Which server do you use? If you use TFS you can look at Eryn for example in runes.lua.
If you have problems with other scripts, you can post them with the errors you get.
 
Last edited:
Sorry, I use uh.. TFS 9.6 and client 9.6. I was using some NPC's that were already in, and trying them out. For example there would be a carlin shop keeper and I would copy it and rename it to a ab'dendriel shop keepers name, and edit what it does and some would show up in-game others would not even though I did the exact same thing. I'll try what you have said and let you all know. Thanks :)

- - - Updated - - -

Okay, still having issues. The NPC's aren't showing up in-game but they are showing up in the editor just fine. The ones that DO show up, will not respond after saying 'yes' to a question. I'm not getting any errors at all.. You can sit there and tell a captain 'yes' to teleport you somewhere and he'll just stare at you like you're retarded.

- - - Updated - - -

Okay, well I finally got NPC's to work.. Still still stillllll having the Boat issues. I've tried several different Boat.lua and xml etc.. I'm clueless as to whats being done wrong. Like I said, everything seems to work until you say yes to the teleport.
 
I'm using 2.14 tfs, and client 9.6. I've tried 'theboat' and 'travel' and 'all_boat' (lua).

Currently I'm using

Code:
<npc name="Captain Steven" script="data/npc/scripts/all_boat.lua" autowalk="1" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="133" head="20" body="120" legs="75" feet="13" corpse="2212"/>
    <parameters>
        <parameter key="module_travel" value="1" />
<parameter key="travel_destinations" value="thais,736,985,6,0;venore,1292,865,6,0;carlin,32387,31821,6,0;ankrahmun,1621,1557,6,0;darashia,1793,1134,6,0;edron,1607,470,6,0;port hope,1058,1457,6,0" />
 
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="job;name;offer;help;mission;quest" />
        <parameter key="keyword_reply1" value="I am the captain of this ship." />
        <parameter key="keyword_reply2" value="My name is Steven. Why do you ask?" />
        <parameter key="keyword_reply3" value="I offer only the possability to travel to far away cities on this continent." />
        <parameter key="keyword_reply4" value="Do I look like a helpful guy to you?" />
        <parameter key="keyword_reply5" value="What are you talking about?" />
        <parameter key="keyword_reply6" value="Hum. I'll tell you what! If you come back in a month or so I might be able to help you with that my friend." />
    </parameters>
</npc>

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!
local travelNode = keywordHandler:addKeyword({'edron'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=33175, y=31764, z=6} })

local travelNode = keywordHandler:addKeyword({'venore'}, StdModule.travel, {npcHandler = npcHandler,  level = 1, cost = 0, destination = {x=32954, y=32022, z=6} })
	
local travelNode = keywordHandler:addKeyword({'thais'}, StdModule.travel, {npcHandler = npcHandler,  level = 1, cost = 0, destination = {x=32313, y=32209, z=6} })

local travelNode = keywordHandler:addKeyword({'carlin'}, StdModule.travel, {npcHandler = npcHandler,  level = 1, cost = 0, destination = {x=32387, y=31821, z=6} })

local travelNode = keywordHandler:addKeyword({'abdendriel'}, StdModule.travel, {npcHandler = npcHandler,  level = 1, cost = 0, destination = {x=32734, y=31669, z=6} })

local travelNode = keywordHandler:addKeyword({'goroma'}, StdModule.travel, {npcHandler = npcHandler,  level = 1, cost = 0, destination = {x=31994, y=32564, z=6} })

local travelNode = keywordHandler:addKeyword({'ankrahmun'}, StdModule.travel, {npcHandler = npcHandler,  level = 1, cost = 0, destination = {x=33425, y=32905, z=6} })

local travelNode = keywordHandler:addKeyword({'svargrond'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=32431, y=31163, z=6} })

local travelNode = keywordHandler:addKeyword({'yalahar'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=32707, y=31079, z=6} })
	

local travelNode = keywordHandler:addKeyword({'zao'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=33032, y=31536, z=10} })

local travelNode = keywordHandler:addKeyword({'razachai'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=33018, y=31216, z=5} })

local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=33624, y=32502, z=6} })

local travelNode = keywordHandler:addKeyword({'liberty bay'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=32360, y=32779, z=6} })

local travelNode = keywordHandler:addKeyword({'port hope'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=32864, y=32805, z=6} })



        keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to Thais, Carlin, Venore, Abdendriel, Edron, Svargrond, Goroma, Ankrahmun, Darashia, Liberty Bay, Port Hope, Yalahar, Zao and Razachai.'})
        -- Makes sure the npc reacts when you say hi, bye etc.
        npcHandler:addModule(FocusModule:new())

I used two others that were pretty much identical with only small changes, and they didn't fix the problem either.
 
Already tried this one? I've tested it on TFS 0.2.14 (Mystic Spirit)
LUA:
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!
local travelNode = keywordHandler:addKeyword({'derelin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Derelin for 119 gold coins?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 119, destination = {x=95, y=115, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})
 
local travelNode = keywordHandler:addKeyword({'drunia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Drunia for 123 gold coins?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 123, destination = {x=967, y=247, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
 
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to Derelin or Drunia for just a small fee.'})
 
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
 
Just tried it, same issue as before. As soon as you say 'yes' to the port he does nothing. I was having same issue with the Oracle when saying yes to a vocation it would do the blue teleportation animation but I would just stand there and no vocation would be had, so I just simply avoided that entirely and just started out with vocations..

I double checked the coordinates in the lua's and there doesn't seem to be any issues at all. No errors or anything. It's pretty strange.
 
I've tested it on the same server you are using, so there must be something wrong, maybe in the xml?
I used this.
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Steven" script="data/npc/scripts/travel.lua" walkinterval="0" floorchange="0">
	<health now="150" max="150"/>
	<look type="151" head="114" body="57" legs="114" feet="114" addons="3"/>
    	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I can bring you to {Derelin} and {Drunia}, where do you want to go?"/>
    	</parameters>
</npc>
 
Ill try that now.. Does AI lua and npc system etc in the lib folder have anything to do with this stuff? It's just weird that the ONLY npc that I can't seem to get to work is the travel one.. wasn't sure if I was missing a script somewhere else that would be causing any sort of 'travel' or 'waypoint' effect to be completed regardless of the NPC.xml and .lua

- - - Updated - - -

Alright, update: I changed it to that XML and changed the travel.ua to all_boat.lua and I changed 'derelin' and 'drunia' to carlin and thais... After you say where you want to go, the NPC doesn't even respond now. I guess this thing hates me. I've followed every tutorial I've seen and examples and I've followed everything you have helped me with.. I'm not sure what else to do.

- - - Updated - - -

Alright, another update.. Started fresh again with the travel NPC. He responds to everything except 'yes' and 'no' you can say bye or town names, ask him his job, blah blah blah.. for some reason he wont respond to yes or no, so I'm thinking his script is correct and all.. but somewhere theres a missing or wrong script for the NPC's to understand yes and no?
 
The only errors I get are like certain monsters that I don't have etc.. nothing about NPC's. As for the NPC Library, the stuff looks all legit to me from what I've read in tutorials and what not and comparisons. But there was an AI folder and other stuff in there too.. I think I'm just gonna delete the extra crap and try it again. I've realize that it doesn't matter what NPC it is, if you say 'yes' or 'no' they don't respond. Only respond to mission, trade, bye, hi, etc..

- - - Updated - - -

I thought maybe if I changed my settings back it would help too, I forgot to mention I tried this a while back. In my config file I changed it from MySQL to sqlite since the server wouldn't boot up otherwise. The dos window would just disappear.
 
I had the same problem with the boat NPCs in xml, but when I tried this one, it worked. Already tried it exactly like this, so just copy and paste it and don't change your script.
Captain Steven.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Steven" script="data/npc/scripts/travel.lua" walkinterval="0" floorchange="0">
	<health now="150" max="150"/>
	<look type="151" head="114" body="57" legs="114" feet="114" addons="3"/>
    	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I can bring you to {Derelin} and {Drunia}, where do you want to go?"/>
    	</parameters>
</npc>
travel.lua
LUA:
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!
local travelNode = keywordHandler:addKeyword({'derelin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Derelin for 119 gold coins?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 119, destination = {x=95, y=115, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})
 
local travelNode = keywordHandler:addKeyword({'drunia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Drunia for 123 gold coins?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 123, destination = {x=967, y=247, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
 
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to Derelin or Drunia for just a small fee.'})
 
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
It should work, because I've tested it on the same server you are using.
 
Limos, you ROCK. I have no idea why this was such a headache but you are awesome! thank you! It works perfectly. Woo finally.. thanks for bearing with me through this I really appreciate it.
 
Last edited:
Back
Top