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

my npc |REP++

IMac

entrepreneur
Joined
May 31, 2009
Messages
2,482
Reaction score
16
Location
Pluto
im traying to make a traveling npc but when u tell him u want to go to xxxx city he doesnt say nothing here the .xml
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Guard Sorrow" script="data/npc/scripts/default.lua" walkinterval="2" floorchange="0">
	<health now="18500" max="18500"/>
	<look type="268" addons="2" head="81" body="97" legs="11" feet="79" corpse="2317"/>
	<parameters>
		<parameter key="module_travel" value="1"/>
		<parameter key="message_greet" value="Welcome To My City"/>
		<parameter key="message_farewall" value="Bye..."/>
		<parameter key="message_walkaway" value="How rude!"/>
		<parameter key="travel_destinations" value="Soldera,1078,1132,6,500;Bayamon,1020,1015,5,500"/>
	</parameters>
</npc>
thx
 
Try This one!

<npc name="Guard Sarrow" script="default.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1">
<health now="18500" max="18500"/>
<look type="129" head="116" body="114" legs="89" feet="95" corpse="1313"/>
corpse="2212"/>
<parameters>
<parameter key="module_travel" value="1" />
<parameter key="message_greet" value="Hello |PLAYERNAME|. I can take you to: {Soldera}, {Bayamon} for free." />
<parameter key="travel_destinations" value="Soldera,1072,1132,6,500;Bayamon,1020,1015,5;" />
</parameters>
</npc>

NOOT TESTED BUT SHOULD WORK!

Rep++ me if i helped you
 
doesnt work :S
PHP:
Guard Sarrow: Hello [admin]Doombringer. I can take you to: Soldera, Bayamon for free.
[admin]Doombringer [1]: soldera
[admin]Doombringer [1]: Soldera
[admin]Doombringer [1]: Bayamon
 
Try using a .lua file as a script instead.

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({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Venore?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=32954, y=32022, 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?'})
        	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!'})

Name it Guard Sarrow.lua and put in NPC/SCRIPTS

Then remake ur .xml file abit

Code:
<npc name="Guard Sarrow" script="default.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1">
<health now="18500" max="18500"/>
<look type="129" head="116" body="114" legs="89" feet="95" corpse="1313"/>
corpse="2212"/>
<parameters>
<parameter key="module_travel" value="1" />
<parameter key="message_greet" value="Hello |PLAYERNAME|. I can take you to: {Soldera}, {Bayamon} for free." />


</npc>

And you will have to change some in the .lua script, like names, costs and destination - shouldnt be a problem :)
 
PHP:
[04/10/2009 11:59:50] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/Guard Sarrow.xml).
[04/10/2009 11:59:50] Info: failed to load external entity "data/npc/Guard Sarrow.xml"
 
Back
Top