• 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

Alaa Adel

Basic Mapper
Joined
Mar 2, 2014
Messages
231
Reaction score
8
I've been looking for a tutorial that shows the boat npc script but i never found a script that works!
So, if anyone knows a working script please post it here!
 
I am using mystic spirit 9.1
and already tried this link and it didn't work.

There was an only script that worked ... i edited the position of the town and name and cost but, when i say the name of the city it keeps working until i say "yes" and nothing happens

what script are you using? maybe this can help?
 
Last edited by a moderator:
Do you use this one? I tested it with Mystic Spirit (later version) and it works for me.
Code:
<?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>

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())
 
Last edited:
If this one is the all functions are in lua one, i tested it and it says cannot find the npc... but the other one worked

the most functions are in xml loads the npc and everything works only when i say "yes" nothing happens please any help
 
Last edited by a moderator:
That's why I said use the one I posted, if you get errors, post them. The xml version indeed doesn't work on Mystic Spirit.

Edit: I noticed there was something missing in the xml of the npc, I only tested the lua, I edited the post with correct xml.
 
Go to data/npc/lib/npcsystem/modules.lua on line 167.
Change
Code:
elseif(doPlayerRemoveMoney(cid, parameters.cost) ~= TRUE) then
To
Code:
elseif(doPlayerRemoveItem(cid, 2160, parameters.cost) ~= TRUE) then

Then instead of 2160, the id of the tokens.
 
What do you mean? Does it still takes away gold instead of tokens? Or do you mean the message?
Did you save modules and restarted the server?
 
Well, it takes gold coins and the message also didn't change and i saved the modules and restarted the server

I changed the message now but it stills takes gold
 
Last edited by a moderator:
It's to big to post here, the modules.lua has 1178 lines of code. You can't add such a large amount of text in 1 post.
 
Back
Top