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

How Block Npc boat to work free acc

armyman

Member
Joined
Feb 15, 2014
Messages
318
Reaction score
14
I have this configuration in config.lua
LUA:
  FreeBoats = false

I put "false" in this line, but the npc's continue working with free acc

NPC boat script.
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local money, randompos
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

function GreyhoundBehaviour (cid, type, msg)

        if(msgcontains(msg:lower(),"yes")) and (npcHandler.Topic == 1) and (npcHandler:isFocused(cid)) then
              if (isPremium(cid) == TRUE) then
                   if (getConfigValue("FreeBoats") == true) or (doPlayerRemoveMoney(cid, money) == TRUE) then
                        v = randompos[math.random(#randompos)]
                        addEvent(doSendMagicEffect, 100, getThingPos(cid), 10)
                        addEvent(doSendMagicEffect, 100, v, 10)
               doTeleportThing(cid,v)
                        npcHandler:setMessage(MESSAGE_TRAVEL, "Set the sails!")
                        npcHandler:onTravel(cid)
                   else
                        npcHandler:say("You don't have enough money.",cid)
                   end
               else
                        npcHandler:say("I'm sorry, but you need a premium account in order to travel onboard our ships.",cid)
               end
                        npcHandler:doTopic(cid, 0)
        elseif(msgcontains(msg:lower(),"thais")) and (npcHandler:isFocused(cid)) then
          if (getPlayerStorageValue(cid, 681) == 1) then
                npcHandler:say("Do you seek a passage to Thais for 100 gold?",cid)
           randompos = {
           {x=32315, y=32209, z=7},
           {x=32313, y=32212, z=7},
           {x=32314, y=32215, z=7},
                }
                money = 100
                npcHandler:doTopic(cid, 1)
          else
                npcHandler:say("Do you seek a passage to Thais for 110 gold?",cid)
           randompos = {
           {x=32315, y=32209, z=7},
           {x=32313, y=32212, z=7},
           {x=32314, y=32215, z=7},
                }
                money = 110
                npcHandler:doTopic(cid, 1)
          end
        elseif(msgcontains(msg:lower(),"ab'dendriel")) and (npcHandler:isFocused(cid)) then
          if (getPlayerStorageValue(cid, 681) == 1) then
                npcHandler:say("Do you seek a passage to Ab'dendriel for 70 gold?",cid)
           randompos = {
           {x=32733, y=31662, z=7},
           {x=32734, y=31666, z=7},
           {x=32732, y=31669, z=7},
                }
                money = 70
                npcHandler:doTopic(cid, 1)
          else
                npcHandler:say("Do you seek a passage to Ab'dendriel for 80 gold?",cid)
           randompos = {
           {x=32733, y=31662, z=7},
           {x=32734, y=31666, z=7},
           {x=32732, y=31669, z=7},
                }
                money = 80
                npcHandler:doTopic(cid, 1)
          end
        elseif(msgcontains(msg:lower(),"edron")) and (npcHandler:isFocused(cid)) then
          if (getPlayerStorageValue(cid, 681) == 1) then
                npcHandler:say("Do you seek a passage to Edron for 100 gold?",cid)
           randompos = {
           {x=33173, y=31765, z=7},
           {x=33177, y=31766, z=7},
           {x=33181, y=31765, z=7},
                }
                money = 100
                npcHandler:doTopic(cid, 1)
          else
                npcHandler:say("Do you seek a passage to Edron for 110 gold?",cid)
           randompos = {
           {x=33173, y=31765, z=7},
           {x=33177, y=31766, z=7},
           {x=33181, y=31765, z=7},
                }
                money = 110
                npcHandler:doTopic(cid, 1)
          end
        elseif(msgcontains(msg:lower(),"venore")) and (npcHandler:isFocused(cid)) then
          if (getPlayerStorageValue(cid, 681) == 1) then
                npcHandler:say("Do you seek a passage to Venore for 120 gold?",cid)
           randompos = {
           {x=32953, y=32023, z=7},
           {x=32960, y=32022, z=7},
           {x=32955, y=32025, z=7},
                }
                money = 120
                npcHandler:doTopic(cid, 1)
          else
                npcHandler:say("Do you seek a passage to Venore for 130 gold?",cid)
           randompos = {
           {x=32953, y=32023, z=7},
           {x=32960, y=32022, z=7},
           {x=32955, y=32025, z=7},
                }
                money = 130
                npcHandler:doTopic(cid, 1)
          end

        elseif (npcHandler.Topic == 1) then
                npcHandler:say("We would like to serve you some time.", cid)
                npcHandler:doTopic(cid, 0)
        end

      npcHandler:AddFocus({"hi", "hello"}, "Welcome on board, Sir |PLAYERNAME|.", "Welcome on board, Madam |PLAYERNAME|.", cid, msg)
      npcHandler:AddQueue({"hi", "hello"}, "One moment please |PLAYERNAME|. You're next in line.", 0, cid, msg)
      npcHandler:RemoveFocus({"bye", "farewell"}, "Good bye. Recommend us, if you were satisfied with our service.", 0, cid, msg)

local keywords = {
["name"] = {response = "My name is Captain Bluebear from the Royal Tibia Line."},
["carlin"] = {response = "This is Carlin. Where do you want to go?"},
["name"] = {response = "My name is Captain Greyhound from the Royal Tibia Line."},
["job"] = {response = "I am the captain of this sailing-ship."},
["captain"] = {response = "I am the captain of this sailing-ship."},
["ship"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["line"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["company"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["route"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["tibia"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["good"] = {response = "We can transport everything you want."},
["passenger"] = {response = "We would like to welcome you on board."},
["trip"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["passage"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["town"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["destination"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["sail"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["go"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["ice"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
["senja"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
["folda"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
["vega"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
["darashia"] = {response = "I'm not sailing there. This route is afflicted by a ghost ship! However I've heard that Captain Fearless from Venore sails there."},
["darama"] = {response = "I'm not sailing there. This route is afflicted by a ghost ship! However I've heard that Captain Fearless from Venore sails there."},
["ghost"] = {response = "Many people who sailed to Darashia never returned because they were attacked by a ghostship! I'll never sail there!"},
}
  for v in pairs(keywords) do
    if (msgcontains(msg, v)) and (npcHandler:isFocused(cid)) then
        npcHandler:say(keywords[v].response, cid)
        npcHandler:doTopic(cid, 0)
    end
  end
  return 1
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, GreyhoundBehaviour)
 
freeboats just means they dont have to pay...

try changing

Code:
if (isPremium(cid) == TRUE) then

to

LUA:
if not isPremium(cid) then
npcHandler:say("You must be premium")
return false
end
 
i got this error in console now when i open the server Obs. I'm using avesta

[Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/greyhound
.lua
data/npc/scripts/greyhound.lua:31: 'end' expected (to close 'function' at line 1
0) near 'elseif'
 
Sigh....ill make this easy for you....

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local money, randompos
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

function GreyhoundBehaviour (cid, type, msg)

        if(msgcontains(msg:lower(),"yes")) and (npcHandler.Topic == 1) and (npcHandler:isFocused(cid)) then
              if not isPremium(cid) then
                npcHandler:say("You must be premium")
                return false
            end
                   if (getConfigValue("FreeBoats") == true) or (doPlayerRemoveMoney(cid, money) == TRUE) then
                        v = randompos[math.random(#randompos)]
                        addEvent(doSendMagicEffect, 100, getThingPos(cid), 10)
                        addEvent(doSendMagicEffect, 100, v, 10)
               doTeleportThing(cid,v)
                        npcHandler:setMessage(MESSAGE_TRAVEL, "Set the sails!")
                        npcHandler:onTravel(cid)
                   else
                        npcHandler:say("You don't have enough money.",cid)
                   end
                        npcHandler:doTopic(cid, 0)
        elseif(msgcontains(msg:lower(),"thais")) and (npcHandler:isFocused(cid)) then
          if (getPlayerStorageValue(cid, 681) == 1) then
                npcHandler:say("Do you seek a passage to Thais for 100 gold?",cid)
           randompos = {
           {x=32315, y=32209, z=7},
           {x=32313, y=32212, z=7},
           {x=32314, y=32215, z=7},
                }
                money = 100
                npcHandler:doTopic(cid, 1)
          else
                npcHandler:say("Do you seek a passage to Thais for 110 gold?",cid)
           randompos = {
           {x=32315, y=32209, z=7},
           {x=32313, y=32212, z=7},
           {x=32314, y=32215, z=7},
                }
                money = 110
                npcHandler:doTopic(cid, 1)
          end
        elseif(msgcontains(msg:lower(),"ab'dendriel")) and (npcHandler:isFocused(cid)) then
          if (getPlayerStorageValue(cid, 681) == 1) then
                npcHandler:say("Do you seek a passage to Ab'dendriel for 70 gold?",cid)
           randompos = {
           {x=32733, y=31662, z=7},
           {x=32734, y=31666, z=7},
           {x=32732, y=31669, z=7},
                }
                money = 70
                npcHandler:doTopic(cid, 1)
          else
                npcHandler:say("Do you seek a passage to Ab'dendriel for 80 gold?",cid)
           randompos = {
           {x=32733, y=31662, z=7},
           {x=32734, y=31666, z=7},
           {x=32732, y=31669, z=7},
                }
                money = 80
                npcHandler:doTopic(cid, 1)
          end
        elseif(msgcontains(msg:lower(),"edron")) and (npcHandler:isFocused(cid)) then
          if (getPlayerStorageValue(cid, 681) == 1) then
                npcHandler:say("Do you seek a passage to Edron for 100 gold?",cid)
           randompos = {
           {x=33173, y=31765, z=7},
           {x=33177, y=31766, z=7},
           {x=33181, y=31765, z=7},
                }
                money = 100
                npcHandler:doTopic(cid, 1)
          else
                npcHandler:say("Do you seek a passage to Edron for 110 gold?",cid)
           randompos = {
           {x=33173, y=31765, z=7},
           {x=33177, y=31766, z=7},
           {x=33181, y=31765, z=7},
                }
                money = 110
                npcHandler:doTopic(cid, 1)
          end
        elseif(msgcontains(msg:lower(),"venore")) and (npcHandler:isFocused(cid)) then
          if (getPlayerStorageValue(cid, 681) == 1) then
                npcHandler:say("Do you seek a passage to Venore for 120 gold?",cid)
           randompos = {
           {x=32953, y=32023, z=7},
           {x=32960, y=32022, z=7},
           {x=32955, y=32025, z=7},
                }
                money = 120
                npcHandler:doTopic(cid, 1)
          else
                npcHandler:say("Do you seek a passage to Venore for 130 gold?",cid)
           randompos = {
           {x=32953, y=32023, z=7},
           {x=32960, y=32022, z=7},
           {x=32955, y=32025, z=7},
                }
                money = 130
                npcHandler:doTopic(cid, 1)
          end

        elseif (npcHandler.Topic == 1) then
                npcHandler:say("We would like to serve you some time.", cid)
                npcHandler:doTopic(cid, 0)
        end

      npcHandler:AddFocus({"hi", "hello"}, "Welcome on board, Sir |PLAYERNAME|.", "Welcome on board, Madam |PLAYERNAME|.", cid, msg)
      npcHandler:AddQueue({"hi", "hello"}, "One moment please |PLAYERNAME|. You're next in line.", 0, cid, msg)
      npcHandler:RemoveFocus({"bye", "farewell"}, "Good bye. Recommend us, if you were satisfied with our service.", 0, cid, msg)

local keywords = {
["name"] = {response = "My name is Captain Bluebear from the Royal Tibia Line."},
["carlin"] = {response = "This is Carlin. Where do you want to go?"},
["name"] = {response = "My name is Captain Greyhound from the Royal Tibia Line."},
["job"] = {response = "I am the captain of this sailing-ship."},
["captain"] = {response = "I am the captain of this sailing-ship."},
["ship"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["line"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["company"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["route"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["tibia"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
["good"] = {response = "We can transport everything you want."},
["passenger"] = {response = "We would like to welcome you on board."},
["trip"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["passage"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["town"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["destination"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["sail"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["go"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
["ice"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
["senja"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
["folda"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
["vega"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
["darashia"] = {response = "I'm not sailing there. This route is afflicted by a ghost ship! However I've heard that Captain Fearless from Venore sails there."},
["darama"] = {response = "I'm not sailing there. This route is afflicted by a ghost ship! However I've heard that Captain Fearless from Venore sails there."},
["ghost"] = {response = "Many people who sailed to Darashia never returned because they were attacked by a ghostship! I'll never sail there!"},
}
  for v in pairs(keywords) do
    if (msgcontains(msg, v)) and (npcHandler:isFocused(cid)) then
        npcHandler:say(keywords[v].response, cid)
        npcHandler:doTopic(cid, 0)
    end
  end
  return 1
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, GreyhoundBehaviour)
 
Try changing

Code:
if not isPremium(cid) then

to

Code:
if getPlayerPremiumDays(cid) < 1 then

Looks like a bug in your distro.
 
Solution
Now is working ! thanks

to do in all npc's boat i need put after this
LUA:
 function GreyhoundBehaviour (cid, type, msg)
add this code in line 12 to 16 right?
LUA:
[LIST=1]
[*]local keywordHandler = KeywordHandler:new()
[*]local npcHandler = NpcHandler:new(keywordHandler)
[*]NpcSystem.parseParameters(npcHandler)
[*]local money, randompos
[*]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
[*]

[*]function GreyhoundBehaviour (cid, type, msg)
[*]

[*]        if(msgcontains(msg:lower(),"yes")) and (npcHandler.Topic == 1) and (npcHandler:isFocused(cid)) then
[*]             if getPlayerPremiumDays(cid) < 1 then
[*]                npcHandler:say("You must be premium")
[*]                return false
[*]            end
[*]                   if (getConfigValue("FreeBoats") == true) or (doPlayerRemoveMoney(cid, money) == TRUE) then
[*]                        v = randompos[math.random(#randompos)]
[*]                        addEvent(doSendMagicEffect, 100, getThingPos(cid), 10)
[*]                        addEvent(doSendMagicEffect, 100, v, 10)
[*]               doTeleportThing(cid,v)
[*]                        npcHandler:setMessage(MESSAGE_TRAVEL, "Set the sails!")
[*]                        npcHandler:onTravel(cid)
[*]                   else
[*]                        npcHandler:say("You don't have enough money.",cid)
[*]                   end
[*]                        npcHandler:doTopic(cid, 0)
[*]        elseif(msgcontains(msg:lower(),"thais")) and (npcHandler:isFocused(cid)) then
[*]          if (getPlayerStorageValue(cid, 681) == 1) then
[*]                npcHandler:say("Do you seek a passage to Thais for 100 gold?",cid)
[*]           randompos = {
[*]           {x=32315, y=32209, z=7},
[*]           {x=32313, y=32212, z=7},
[*]           {x=32314, y=32215, z=7},
[*]                }
[*]                money = 100
[*]                npcHandler:doTopic(cid, 1)
[*]          else
[*]                npcHandler:say("Do you seek a passage to Thais for 110 gold?",cid)
[*]           randompos = {
[*]           {x=32315, y=32209, z=7},
[*]           {x=32313, y=32212, z=7},
[*]           {x=32314, y=32215, z=7},
[*]                }
[*]                money = 110
[*]                npcHandler:doTopic(cid, 1)
[*]          end
[*]        elseif(msgcontains(msg:lower(),"ab'dendriel")) and (npcHandler:isFocused(cid)) then
[*]          if (getPlayerStorageValue(cid, 681) == 1) then
[*]                npcHandler:say("Do you seek a passage to Ab'dendriel for 70 gold?",cid)
[*]           randompos = {
[*]           {x=32733, y=31662, z=7},
[*]           {x=32734, y=31666, z=7},
[*]           {x=32732, y=31669, z=7},
[*]                }
[*]                money = 70
[*]                npcHandler:doTopic(cid, 1)
[*]          else
[*]                npcHandler:say("Do you seek a passage to Ab'dendriel for 80 gold?",cid)
[*]           randompos = {
[*]           {x=32733, y=31662, z=7},
[*]           {x=32734, y=31666, z=7},
[*]           {x=32732, y=31669, z=7},
[*]                }
[*]                money = 80
[*]                npcHandler:doTopic(cid, 1)
[*]          end
[*]        elseif(msgcontains(msg:lower(),"edron")) and (npcHandler:isFocused(cid)) then
[*]          if (getPlayerStorageValue(cid, 681) == 1) then
[*]                npcHandler:say("Do you seek a passage to Edron for 100 gold?",cid)
[*]           randompos = {
[*]           {x=33173, y=31765, z=7},
[*]           {x=33177, y=31766, z=7},
[*]           {x=33181, y=31765, z=7},
[*]                }
[*]                money = 100
[*]                npcHandler:doTopic(cid, 1)
[*]          else
[*]                npcHandler:say("Do you seek a passage to Edron for 110 gold?",cid)
[*]           randompos = {
[*]           {x=33173, y=31765, z=7},
[*]           {x=33177, y=31766, z=7},
[*]           {x=33181, y=31765, z=7},
[*]                }
[*]                money = 110
[*]                npcHandler:doTopic(cid, 1)
[*]          end
[*]        elseif(msgcontains(msg:lower(),"venore")) and (npcHandler:isFocused(cid)) then
[*]          if (getPlayerStorageValue(cid, 681) == 1) then
[*]                npcHandler:say("Do you seek a passage to Venore for 120 gold?",cid)
[*]           randompos = {
[*]           {x=32953, y=32023, z=7},
[*]           {x=32960, y=32022, z=7},
[*]           {x=32955, y=32025, z=7},
[*]                }
[*]                money = 120
[*]                npcHandler:doTopic(cid, 1)
[*]          else
[*]                npcHandler:say("Do you seek a passage to Venore for 130 gold?",cid)
[*]           randompos = {
[*]           {x=32953, y=32023, z=7},
[*]           {x=32960, y=32022, z=7},
[*]           {x=32955, y=32025, z=7},
[*]                }
[*]                money = 130
[*]                npcHandler:doTopic(cid, 1)
[*]          end
[*]

[*]        elseif (npcHandler.Topic == 1) then
[*]                npcHandler:say("We would like to serve you some time.", cid)
[*]                npcHandler:doTopic(cid, 0)
[*]        end
[*]

[*]      npcHandler:AddFocus({"hi", "hello"}, "Welcome on board, Sir |PLAYERNAME|.", "Welcome on board, Madam |PLAYERNAME|.", cid, msg)
[*]      npcHandler:AddQueue({"hi", "hello"}, "One moment please |PLAYERNAME|. You're next in line.", 0, cid, msg)
[*]      npcHandler:RemoveFocus({"bye", "farewell"}, "Good bye. Recommend us, if you were satisfied with our service.", 0, cid, msg)
[*]

[*]local keywords = {
[*]["name"] = {response = "My name is Captain Bluebear from the Royal Tibia Line."},
[*]["carlin"] = {response = "This is Carlin. Where do you want to go?"},
[*]["name"] = {response = "My name is Captain Greyhound from the Royal Tibia Line."},
[*]["job"] = {response = "I am the captain of this sailing-ship."},
[*]["captain"] = {response = "I am the captain of this sailing-ship."},
[*]["ship"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
[*]["line"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
[*]["company"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
[*]["route"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
[*]["tibia"] = {response = "The Royal Tibia Line connects all seaside towns of Tibia."},
[*]["good"] = {response = "We can transport everything you want."},
[*]["passenger"] = {response = "We would like to welcome you on board."},
[*]["trip"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
[*]["passage"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
[*]["town"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
[*]["destination"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
[*]["sail"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
[*]["go"] = {response = "Where do you want to go? To Thais, Ab'Dendriel, Venore or Edron?"},
[*]["ice"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
[*]["senja"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
[*]["folda"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
[*]["vega"] = {response = "I'm sorry, but we don't serve the routes to the Ice Islands."},
[*]["darashia"] = {response = "I'm not sailing there. This route is afflicted by a ghost ship! However I've heard that Captain Fearless from Venore sails there."},
[*]["darama"] = {response = "I'm not sailing there. This route is afflicted by a ghost ship! However I've heard that Captain Fearless from Venore sails there."},
[*]["ghost"] = {response = "Many people who sailed to Darashia never returned because they were attacked by a ghostship! I'll never sail there!"},
[*]}
[*]  for v in pairs(keywords) do
[*]    if (msgcontains(msg, v)) and (npcHandler:isFocused(cid)) then
[*]        npcHandler:say(keywords[v].response, cid)
[*]        npcHandler:doTopic(cid, 0)
[*]    end
[*]  end
[*]  return 1
[*]end
[*]

[*]npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, GreyhoundBehaviour)
[/LIST]
 
try with this npc, is an example of yalahar npc, captain max
go to any .lua of traveling npcs at data/npc/scripts and use

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

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

local travelNode = keywordHandler:addKeyword({'yalahar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Yalahar for 400 gold though. Is that ok with you?'})
            travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 400, destination = {x=32803, y=31270, z=6} })
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Maybe another time, then.'})
        
            local travelNode = keywordHandler:addKeyword({'calassa'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Calassa though. Do you want me to do it?'})
            travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=31911, y=32710, z=6} })
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Maybe another time, then.'})
    
        keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'That is quite a long unprofitable travel. I\'ll bring you to Yalahar for 400 gold though. Is that ok with you?'})
        keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
        keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})

npcHandler:addModule(FocusModule:new())

how to configure? check first here, you can put the words u have to say to travel to "x" location

Code:
local travelNode = keywordHandler:addKeyword({'yalahar'}

then see this line to configre the rest (including premium requeriment)

Code:
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=31911, y=32710, z=6} })

here u can change coordinates, level, cost and if premium is requiered
 
Back
Top