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

I need a working boat script , REP++ :)

Damon

Check my status to contact me :)
Joined
Mar 26, 2011
Messages
6,219
Solutions
1
Reaction score
2,038
Location
Germany
Hello,
What I am looking for is a boat npc, which I can simply edit.
so i can edit coordinates and cities and add new ones to travel to
It should sail ONLY PREMIUM PLAYERS!
 
Added 3 real tibia cities as example, you can just change the names or add more locations by adding more lines.

Only thing you also have to change are the names in this line.
LUA:
	selfSay('Where do you want to go? I can bring you to Thais, Carlin or Venore.', cid)

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
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 creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
local locations = {
	["Thais"] = {pos = {x = 100, y = 100, z = 7}, gold = 100}, 
	["Carlin"] = {pos = {x = 100, y = 100, z = 7}, gold = 120},
	["Venore"] = {pos = {x = 100, y = 100, z = 7}, gold = 90} 
}

 	local function addCptl(first, rest)
  		return first:upper()..rest:lower()
	end
 
	local x = locations[msg:gsub("(%a)([%w_']*)", addCptl)]

	local travel = (msgcontains(msg, 'travel'))
	if travel then
		if getPlayerPremiumDays(cid) >= 1 then
			selfSay('Where do you want to go? I can bring you to Thais, Carlin or Venore.', cid)
			talkState[talkUser] = 1
		else
			selfSay('Travel is only for premium.', cid)
		end
	end
 
	if x and talkState[talkUser] == 1 then 
		selfSay('Do you want to travel to '..msg..' for '..x.gold..' gold?', cid)
		xmsg = msg
		talkState[talkUser] = 2
	end
 
	local agree = (msgcontains(msg, 'yes'))
	if agree and talkState[talkUser] == 2 then
                x = locations[xmsg:gsub("(%a)([%w_']*)", addCptl)]
		if doPlayerRemoveMoney(cid, x.gold) then
			selfSay('Here you go, have a fun trip to '..xmsg..'.', cid)
			doTeleportThing(cid, x.pos)
			talkState[talkUser] = 0
		else
			selfSay('You don\'t have enough money.', cid)
			talkState[talkUser] = 0
		end
	end
 
	if not x and not travel and not agree then
		selfSay('What? I don\'t understand what you mean with '..msg..'.', cid)
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top