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

Possibility to end up in Ghost ship

Linken93

Member
Joined
Apr 6, 2010
Messages
313
Reaction score
7
Location
SWEDEN
Hi!

I've been searching around for this and found some examples but I cannot figure it out how I should do it with this boat script.

I need to add this to the script but as you see it need to be rewritten.

Code:
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, 'darashia') then
		selfSay('Do you want to sail to Darashia?', cid)
		Topic[cid] = 1
	elseif Topic[cid] == 1 then
		if msgcontains(msg, 'yes') then
			if isPremium(cid) then
				if not isPlayerPzLocked(cid) then
					local pos = math.random(10) == 1 and {x=33330, y=32172, z=5} or {x=33290, y=32481, z=6}
					selfSay('Set the sails!', cid)
					npcHandler:releaseFocus(cid)
					doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
					doTeleportThing(cid, pos)
					doSendMagicEffect(pos, CONST_ME_TELEPORT)

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
function kick(cid, message, keywords, parameters, node)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	npcHandler:releaseFocus(cid)
	local tmp, new = getThingPos(cid), {x = math.random(32954, 32954), y = math.random(32027, 32029), z = 6}
	doTeleportThing(cid, new)
	doSendMagicEffect(tmp, CONST_ME_TELEPORT)
	doSendMagicEffect(new, CONST_ME_TELEPORT)

	return true
end

	keywordHandler:addKeyword({'kick'}, kick, {})
 
 local t = {
	{'Carlin', {x=32387, y=31820, z=6}},
	{'Ab\'dendriel', {x=32734, y=31668, z=6}},
	{'Edron', {x=33173, y=31764, z=6}},
	{'Thais', {x=32310, y=32210, z=6}},
	{'Port Hope', {x=32527, y=32784, z=6}},
	{'Svargrond', {x=32341, y=31108, z=6}},
	{'Yalahar', {x=32816, y=31272, z=6}},
	{'Darashia', {x=33289, y=32480, z=6}},
	{'Ankrahmun', {x=33092, y=32883, z=6}},
	{'Goroma', {x=32161, y=32557, z=6}},
        {'Liberty Bay', {x=32285, y=32892, z=6}},
	{'sail', 'Where do you want to go? To Carlin, Ab\'Dendriel, Edron, Thais, Port Hope, Itilia, Venore, Liberty Bay, Svargrond, Yalahar, Darashia, Ankrahmun or Goroma?'},
	{'job', 'I am the captain of this ship.'},
	{'captain', 'I am the captain of this ship.'}
}
 
for i = 1, #t do
	local v = t[i]
	if type(v[2]) == 'table' then
		keywordHandler:addKeyword({v[1]:lower()}, StdModule.travel, {npcHandler = npcHandler, level = 0, cost = 0, destination = v[2]})
	else
		keywordHandler:addKeyword({v[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = v[2]})
	end
end
 
t = nil
npcHandler:addModule(FocusModule:new())

Thanks in advance!
 
Last edited:
Back
Top