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

Dixter

Amateur Web Developer
Joined
Mar 31, 2009
Messages
660
Reaction score
11
I got a problem with some ship npcs, you can't sail from certain cities to certain cities. like say you cant sail from thais to ab dendriel, but you can sail from CARLIN to ab dendriel. You can't sail to liberty bay from anywhere i think. All my boat_"name of city".lua's are the same so here is what i use for them(its boat_thais)

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
        
        
        
        local travelNode = keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Carlin for 0 gold coins?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32387, y=31820, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

        local travelNode = keywordHandler:addKeyword({'yalahar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Yalahar for 0 gold coins?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=602, y=670, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

        local travelNode = keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Thais for 0 gold coins?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32312, y=32212, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

        local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Darashia for 0 gold coins?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=33289, y=32480, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

        local travelNode = keywordHandler:addKeyword({'ankrahmun'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Ankrahmun for 0 gold coins?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=33092, y=32883, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

        local travelNode = keywordHandler:addKeyword({'cormaya'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Cormaya for 0 gold coins?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=33288, y=31957, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

   	local travelNode = keywordHandler:addKeyword({'svargrond'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Svargrond for 0 gold coins?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32430, y=31164, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

   	local travelNode = keywordHandler:addKeyword({'liberty Bay'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Liberty Bay for 0 gold coins?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=33283, y=32892, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
        
	local travelNode = keywordHandler:addKeyword({'ab dendriel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Ab\'dendriel for 0 gold coins?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32734, y=31668, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
        
	local travelNode = keywordHandler:addKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Venore for 0 gold coins?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32952, y=32022, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
        
	local travelNode = keywordHandler:addKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Edron for 0 gold coins?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=33173, y=31764, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
        
	local travelNode = keywordHandler:addKeyword({'port hope'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Port Hope for 0 gold coins?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32527, y=32784, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
        
        keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = false, text = 'I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, Rook, and Darashia.'})
        keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
        keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, Rook, and Darashia.'})
        -- Makes sure the npc reacts when you say hi, bye etc.
        npcHandler:addModule(FocusModule:new())

And now the individual xml ones

Captain ank.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Ank" script="boat_ankrahmun.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="134" head="95" body="10" legs="56" feet="77" addons="0"/>
<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, and Darashia."/>
	</parameters>
</npc>

Captain Cormaya.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Cormaya" script="boat_cormaya.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="19" body="113" legs="95" feet="115" addons="0"/>
<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, and Darashia."/>
	</parameters>
</npc>

Captain Edron.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Edron" script="boat_edron.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="19" body="113" legs="95" feet="115" addons="0"/>
<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, and Darashia."/>
	</parameters>
</npc>

Captain LB.xml(liberty bay)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain LB" script="boat_libertybay.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="134" head="95" body="10" legs="56" feet="77" addons="0"/>
 <parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, and Darashia."/>
	</parameters>
</npc>

Captain Thais.xml:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Thais" script="boat_thais.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="19" body="69" legs="107" feet="50" addons="0"/>
 <parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, and Darashia."/>
	</parameters>
</npc>

Captain Yala.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Yala" script="boat_yalahar.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="96" head="0" body="0" legs="0" feet="0" addons="0"/>
<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, and Darashia."/>
	</parameters>
</npc>

Captain Ab.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Ab" script="boat_ab.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="60" body="113" legs="95" feet="115" addons="0"/>
<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, and Darashia."/>
	</parameters>
</npc>

Captain Carlin.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Carlin" script="boat_carlin.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="96" body="113" legs="95" feet="115" addons="0"/>
<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, and Darashia."/>
	</parameters>
</npc>

Captain Darashia.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Darashia" script="boat_darashia.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="19" body="113" legs="95" feet="115" addons="0"/>
<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, and Darashia."/>
	</parameters>
</npc>

Captain Hope.xml(port hope):
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Hope" script="boat_port hope.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="60" body="113" legs="95" feet="115" addons="0"/>
<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, and Darashia."/>
	</parameters>
</npc>

Captain Svargrond.xml:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Svargrond" script="boat_svargrond.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="142" head="97" body="23" legs="28" feet="76" addons="2"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, and Darashia."/>
</parameters>
</npc>[/CODE]

Captain Venore.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Venore" script="boat_venore.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="19" body="113" legs="95" feet="115" addons="0"/>
<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you to Thais, Carlin, Ab dendriel, Venore, Port Hope, Edron, Yalahar, Liberty Bay, Svargrond, Cormaya, Ankrahmun, and Darashia."/>
	</parameters>
</npc>
 
can you tell me the error you get?
or more specifically the problem.

try copy and pasting existing texts like this
into troubled ones to check if it fixes the problem (obviously change Svargrond respectively to the right town)

local travelNode = keywordHandler:addKeyword({'svargrond'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Svargrond for 0 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32430, y=31164, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})

Plus it looks like to be that the code is being feed through Ex. boat_cormaya.lua not the function itself

also what is the file called that you pulled the first big code from?
 
i dont get any errors, and when i try to reload npcs, my server crashes, however no errors come up ;o?
 
When you reload npcs and your server crashes is because you dont have enough memory in your computer.
 
Back
Top