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

Boat NPC

habiba

New Member
Joined
Aug 26, 2007
Messages
586
Reaction score
4
Location
Örebro, Sweden
Need a boat npc for 0.2.9

this is not working

(Mystic Spirit (0.2.9)\data\npc\boat.xml

Code:
<npc name="Captain Steven" script="data/npc/scripts/travel.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="derelin,1294,429,6,119;farda,865,251,6,123;taqinata,868,690,6,134" />
		
		<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>


(Mystic Spirit (0.2.9)\data\npc\scripts\travel)
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



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

By MokerHamer)
habiba, Please use code tags next time =)
 
Last edited by a moderator:
I have this script, i think the best \/

<?xml version="1.0"?>
<npc name="Captain Tarall" script="data/npc/scripts/NpcBoat.lua" autowalk="1" floorchange="0" access="5" level="1" maglevel="1">

<health now="100" max="100"/>

<look type="151" head="0" body="119" legs="115" feet="76" addons="1" corpse="2212"/>

<parameters>
<parameter key="message_greet" value="Welcome on board, Sir |PLAYERNAME|." />
<parameter key="message_needmoremoney" value="Sorry, |PLAYERNAME|. You don't have enough money." />
<parameter key="message_decline" value="Not good enough, is it?" />
<parameter key="message_walkaway" value="Set the sails." />
<parameter key="message_farewell" value="Good bye. Recommend us, if you were satisfied with our service." />

<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="name;job;help;quest;mission" />
<parameter key="keyword_reply1" value="My name is Captain Tarrall from the Royal Astonia Line." />
<parameter key="keyword_reply2" value="I am the captain of this sailing-ship." />
<parameter key="keyword_reply3" value="I can I take it it: ~~/~~/~~/~~. where you go to?" />
<parameter key="keyword_reply4" value="What are you talking about?" />
<parameter key="keyword_reply5" value="Humm... Sorry i don't know." />
</parameters>
</npc>

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() 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({'CITY HERE'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'TEXT HERE!'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 10, destination = {x=XX, y=YY, z=ZZ} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Me procure quando quiser...'})

local travelNode = keywordHandler:addKeyword({'OTHER CITY'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'OTHER TEXT'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 20, destination = {x=XX, y=YY, z=ZZ} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Ta louco eh?'})

keywordHandler:addKeyword({'MSG FOR HELP'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'BLAH, BLAH...'})

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

Yours,
DiegoS.
 
Well u can make an boat npc in 2 ways like this.

=======================Version 1=============================
data\npc\Boat.xml (most functions in boat.xml):

Code:
<npc name="Captain Steven" script="data/npc/scripts/travel.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="derelin,1294,429,6,119;farda,865,251,6,123;taqinata,868,690,6,134" />
		
		<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>

data\npc\scripts\travel.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



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


================================Version 2========================
data\npc\Boat.xml (All functions are in lua):

Code:
<npc name="Captain Steven" script="data/npc/scripts/travel.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>
		
	</parameters>
</npc>


data\npc\scripts\travel.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!
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=1367, y=403, 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())

if you want more npc examples check out this thread.
http://otland.net/showthread.php?t=1039&highlight=npc+examples
 
Back
Top