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

NPC Re-edit.

azzkaban

Monster Maker
Joined
Feb 23, 2010
Messages
1,101
Reaction score
195
Location
Iquique Chile
Hi, I need NPC, check vocation to travel:


NO VOCATION:

Player: Hi
NPC: Hello [PLAYER NAME ], need you [travel]?
Player yes
NPC: You dont have vocation, please come back another day [stupid]!



WITH VOCATION:

Player: Hi
NPC: Hello [PLAYER NAME ], need you [travel]?
Player: yes
NPC: Ok, nice travel.



Main 1 Travel position: 1000 1000 7

Main 2 Travel position: 2000 2000 7

Thank you. Rep+ for you.

Maybe you can re-edit this for my script =)

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, Town = {}, {}
 
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 thinkCallback(cid)
	if math.random(300) == 1 then
		npcHandler:say("Harr! Wanna go off this island? Need me an' my ship!")
	end
	return true
end
 
function creatureSayCallback(cid, type, msg)
	if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
		local v, k = getPlayerVocation(cid), getCreatureName(cid)
		if v == 0 then
			npcHandler:say(getPlayerSex(cid) == 0 and "Well hello there, lovely lady! Can't sail you anywhere without a {vocation}, though. Y'should talk to the four vocation {masters} first, " .. k .. "." or "How cute, a freshly hatched newcomer. Harr. Can't leave this island without a {vocation}, y'know? Y'should talk to the four vocation {masters} first, " .. k.. ".", cid)
			Topic[cid] = 0
		else
			npcHandler:say("Harrr, a new " .. getVocationInfo(v).name .. "! Can't wait to get off this lousy island and head for adventure, eh? Want me to bring ya somewhere nice, I rlly recomend you thais cuz the king lives ther an also if u wanna hav' lot f fun, " .. k .. "?", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
		npcHandler:addFocus(cid)
	elseif(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
		npcHandler:say("Hrrrm. Better y'stay here for a bit, aight.", cid, TRUE)
		Topic[cid] = nil
		Town[cid] = nil
		npcHandler:releaseFocus(cid)
	elseif Topic[cid] == 1 then
		if msgcontains(msg, "yes") then
			npcHandler:say("Take a hint from old Cap'n Kurt. Make sure y'dun leave here before yer equipped well. Ya went for rob- err, shopping and got stuff like rope, armor, and weap'n?", cid)
			Topic[cid] = 2
		elseif msgcontains(msg, "no") then
			npcHandler:say("Then what'd ya want? Learn about the main Tibian cities?", cid)
			Topic[cid] = 3
		else
			npcHandler:say("Kid, one thing y'should learn. Answer with {yes} or {no} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = 1
		end
	elseif Topic[cid] == 2 then
		if msgcontains(msg, "yes") then
			npcHandler:say("Harrharr. Good answer. Wanna know somethin' about the main Tibian cities before you choose yer new home?", cid)
			Topic[cid] = 3
		elseif msgcontains(msg, "no") then
			npcHandler:say("Then prepare yourself and come back later, eh?", cid)
			npcHandler:releaseFocus(cid)
			Topic[cid] = nil
		end
	elseif Topic[cid] == 3 then
		if msgcontains(msg, "yes") then
			npcHandler:say("Aye. Wanna know about {Ab'Dendriel}, {Ankrahmun}, {Carlin}, {Darashia}, {Edron}, {Kazordoon}, {Liberty} {Bay}, {Port} {Hope}, {Svargrond}, {Thais}, {Venore} or {Yalahar}?", cid)
			Topic[cid] = 0
		elseif msgcontains(msg, "no") then
			npcHandler:say(isPremium(cid) and "So ya know it all, eh? Where'd ya want me to bring ya then, kid? {Ab'Dendriel}, {Ankrahmun}, {Carlin}, {Darashia}, {Edron}, {Liberty Bay}, {Port Hope}, {Thais} or {Venore}?" or "So ya know it all, eh? Where'd ya want me to bring ya then, kid? {Ab'Dendriel}, {Carlin}, {Thais} or {Venore}?", cid)
			Topic[cid] = 4
		end
	elseif Topic[cid] == 4 then
		if msgcontains(msg, "ab'dendriel") then
			npcHandler:say("So it's Ab'Dendriel y'wanna live in? What y'say, {yes} or {no}?", cid)
			Topic[cid] = 5
			Town[cid] = "Ab'Dendriel"
		elseif msgcontains(msg, "ankrahmun") then
			if isPremium(cid) then
				npcHandler:say("So it's Ankrahmun y'wanna live in? What y'say, {yes} or {no}?", cid)
				Topic[cid] = 5
				Town[cid] = 'Ankrahmun'
			else
				npcHandler:say("Nope, can't bring y'there without a premium account. Y'should be glad you get to travel by ship, usually a premium service, too, y'know.", cid)
				Topic[cid] = 0
			end
		elseif msgcontains(msg, "carlin") then
			npcHandler:say("So it's Carlin y'wanna live in? What y'say, {yes} or {no}?", cid)
			Topic[cid] = 5
			Town[cid] = 'Carlin'
		elseif msgcontains(msg, "darashia") then
			if isPremium(cid) then
				npcHandler:say("So it's Darashia y'wanna live in? What y'say, {yes} or {no}?", cid)
				Topic[cid] = 5
				Town[cid] = 'Darashia'
			else
				npcHandler:say("Nope, can't bring y'there without a premium account. Y'should be glad you get to travel by ship, usually a premium service, too, y'know.", cid)
				Topic[cid] = 0
			end
		elseif msgcontains(msg, "edron") then
			if isPremium(cid) then
				npcHandler:say("So it's Edron y'wanna live in? What y'say, {yes} or {no}?", cid)
				Topic[cid] = 5
				Town[cid] = 'Edron'
			else
				npcHandler:say("Nope, can't bring y'there without a premium account. Y'should be glad you get to travel by ship, usually a premium service, too, y'know.", cid)
				Topic[cid] = 0
			end
		elseif msgcontains(msg, "liberty") and msgcontains(msg, "bay") then
			if isPremium(cid) then
				npcHandler:say("So it's Liberty Bay y'wanna live in? What y'say, {yes} or {no}?", cid)
				Topic[cid] = 5
				Town[cid] = 'Liberty Bay'
			else
				npcHandler:say("Nope, can't bring y'there without a premium account. Y'should be glad you get to travel by ship, usually a premium service, too, y'know.", cid)
				Topic[cid] = 0
			end
		elseif msgcontains(msg, "port") and msgcontains(msg, "hope") then
			if isPremium(cid) then
				npcHandler:say("So it's Port Hope y'wanna live in? What y'say, {yes} or {no}?", cid)
				Topic[cid] = 5
				Town[cid] = 'Port Hope'
			else
				npcHandler:say("Nope, can't bring y'there without a premium account. Y'should be glad you get to travel by ship, usually a premium service, too, y'know.", cid)
				Topic[cid] = 0
			end
		elseif msgcontains(msg, "thais") then
			npcHandler:say("So it's Thais y'wanna live in? What y'say, {yes} or {no}?", cid)
			Topic[cid] = 5
			Town[cid] = 'Thais'
		elseif msgcontains(msg, "venore") then
			npcHandler:say("So it's Venore y'wanna live in? What y'say, {yes} or {no}?", cid)
			Topic[cid] = 5
			Town[cid] = 'Venore'
		else
			npcHandler:say("Nope, wha'ever that is, I dun sail there. ".. isPremium(cid) and "{Ab'Dendriel}, {Ankrahmun}, {Carlin}, {Darashia}, {Edron}, {Liberty Bay}, {Port Hope}, {Thais} or {Venore}" or "{Ab'Dendriel}, {Carlin}, {Thais} or {Venore}" .."?", cid)
			Topic[cid] = 5
		end
	elseif msgcontains(msg, "passage") or msgcontains(msg, "sail") or msgcontains(msg, "travel") then
		if getPlayerVocation(cid) == 0 then
			npcHandler:say("Nope, yer not going anywhere. Can't transport ya without a {vocation}, y'know?", cid)
			Topic[cid] = 0
		else
			npcHandler:say("So, y'chose your new home city? Which one's it gonna be?", cid)
			Topic[cid] = 4
		end
	elseif Topic[cid] == 5 then
		if msgcontains(msg, 'yes') then
			npcHandler:say("And off we go! If yer lost, dun forget t'talk to the guide on the ship!", cid)
			local v = getTownId(Town[cid])
			npcHandler:releaseFocus(cid)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, getTownTemplePosition(v))
			doSendMagicEffect(getTownTemplePosition(v), CONST_ME_TELEPORT)
			doPlayerSetTown(cid, v)
			Topic[cid] = nil
		else
			npcHandler:say("Changed yer mind? What city d'ya wanna head to, {Ab'Dendriel}, {Ankrahmun}, {Carlin}, {Darashia}, {Edron}, {Liberty Bay}, {Port Hope}, {Thais} or {Venore}?", cid)
			Topic[cid] = 4
		end
		Town[cid] = nil
	elseif msgcontains(msg, "ab'dendriel") then
		npcHandler:say("Ab... Den... wha'ever, I never get that spelling right. Main city of the elves, lots of trees 'n stuff. Very cosy and safe I guess if yer fond of nature. I can {sail} there if ya like.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "ankrahmun") then
		npcHandler:say("Only for {premium} travellers! Desert pyramid city close to the ocean, far too hot and dry for my taste. But word is there are good hunting grounds nearby. I can {sail} there if ya like.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "carlin") then
		npcHandler:say("A city ruled by crazy amazon women! Blimey! Depends on yer taste whether ya think that's good or not. Harr. I can {sail} there if ya like.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "darashia") then
		npcHandler:say("Only for {premium} travellers! One of the two desert cities. Built around an oasis. Decent location for a newcomer. I can {sail} there if ya like.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "edron") then
		npcHandler:say("Only for {premium} travellers! Quiet little castle city on an island in the north-eastern part of Tibia. Good place for starters, really. I can {sail} there if ya like.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "kazordoon") then
		npcHandler:say("The underground dwarven city. Doesn't have a real harbour, so I can't bring ya there, y'know.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "liberty") and msgcontains(msg, "bay") then
		npcHandler:say("Only for {premium} travellers! Liberty Bay is on an island group in the South Seas. Pirates 'n stuff, y'know. Gotta be careful, but good hunting location. I can {sail} there if ya like.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "port") and msgcontains(msg, "hope") then
		npcHandler:say("Only for {premium} travellers! Port Hope is an outpost right in the middle of the jungle. Who'd want to go there?? Except for really crazy adventurers? I can {sail} there if ya like.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "svargrond") then
		npcHandler:say("Nah, can't bring ya there. Those nordic barbarians have their own rules of who they wanna let live in their city. But go there sometime, heard it's quite interesting.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "thais") then
		npcHandler:say("Old-school city. Actually the oldest main city in Tibia. Be careful on those streets, there're bandits everywhere. I can {sail} there if ya like.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "venore") then
		npcHandler:say("Harrr, one of the richest cities, filled with merchants. Dunno though why they built it over a stinking swamp. Go there if ya have a good sense of orientation. I can {sail} there if ya like.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "yalahar") then
		npcHandler:say("Now that must be one o' the biggest cities I've ever seen. Might be not cosy for a newcomer like yerself though. And I can't sail there anyway... they don't let everyone enter their fine pretty harbour, y'know.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "rookgaard") then
		npcHandler:say("Nah, y'dun wanna go back there.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "main") then
		npcHandler:say("The main continent can be dangerous. Other fellas can kill ya, y'know? So be careful! Wanna go there, ask fo' a {passage}.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "master") then
		npcHandler:say("Lemme get this right, ahum. {Estrella}, {Hykrion}, {Narai} and {Yandur}. Aye, that's it.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "estrella") then
		npcHandler:say("Scary lady. Makes me feel sorta stupid at times. Talk t'her for {sorcerer} info.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "hykrion") then
		npcHandler:say("Harr. My training partner, aye. Talk t'him for {knight} info.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "narai") then
		npcHandler:say("Harrrrrrrrrr. Nuff said. Talk t'her for {paladin} info.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "raffael") then
		npcHandler:say("A shop without rum or beer ain't a good shop. Just my opinion, man.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "kurt") then
		npcHandler:say("Hrm?", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "yandur") then
		npcHandler:say("Can be nice t'have a healer around. Talk t'him for {druid} info.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "knight") then
		npcHandler:say("Rock solid vocation. Easy t'play, hard t'master.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "sorcerer") then
		npcHandler:say("Turns out pretty powerful in the end.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "druid") then
		npcHandler:say("Decent vocation. Healing's always nice.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "paladin") then
		npcHandler:say("I prefer t'have my enemies closer to my face than those distance fighters. Harrr.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "vocation") then
		npcHandler:say("Ya must have one if ya wanna leave here. Need some power before going to the {main} continent, aye!", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "ship") then
		npcHandler:say("She's pretty, ain't she? Will bring ya almost anywhere and even fo' free. Just once though! Gotta ask fo' a {passage}.", cid)
		Topic[cid] = 0
	elseif msgcontains(msg, "premium") then
		npcHandler:say("Some regions in the world can't be accessed by everyone. Gotta pay, y'know? If y'spend some real cash fo' premium time, I can bring ya t'much cooler locations.", cid)
		Topic[cid] = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Hrrrrm. And a good day to you, too!")
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)

- - - Updated - - -

Bump?
 
check it
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, Town = {}, {}
local travel = {
	['travel1'] = {{x=1000, y=1000, z=7}},
	['travel 1'] = {{x=1000, y=1000, z=7}},
	['1'] = {{x=1000, y=1000, z=7}},
	['travel2']{{x=2000, y=2000, z=7}},
	['travel 2'] = {{x=2000, y=2000, z=7}},
	['2'] = {{x=2000, y=2000, z=7}},
}
 
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 thinkCallback(cid)
	if math.random(300) == 1 then
		npcHandler:say("Harr! Wanna go off this island? Need me an' my ship!")
	end
	return true
end
 
function creatureSayCallback(cid, type, msg)
local travel = travel[msg]
	if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
		local v, k = getPlayerVocation(cid), getCreatureName(cid)
		if v > 0 then
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
		npcHandler:addFocus(cid)
	elseif(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
		npcHandler:say("Bye, remember come back later.", cid, TRUE)
		Topic[cid] = nil
		Town[cid] = nil
		npcHandler:releaseFocus(cid)
	elseif Topic[cid] == 1 then
		if msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") then
			npcHandler:say("Are you sure the use travel 1?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("I only understand if you say travel 1 or travel 2." or "Kid, one thing y'should learn. Answer with {travel 1} or {travel 2} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = nil
		end
		elseif msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") and v == 0 then
			npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
			Topic[cid] = nil
		elseif msgcontains(msg, "travel 2") or msgcontains(msg, "travel2") or msgcontains(msg, "2") and v > 0 then
			npcHandler:say("Are you sure the use travel 2?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
			Topic[cid] = nill
			Town[cid] = nil
		end
	elseif Topic[cid] == 5 then
		if msgcontains(msg, 'yes') then
			npcHandler:say("Ok, nice travel.", cid)
			npcHandler:releaseFocus(cid)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, travel[1])
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			Topic[cid] = nil
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Choose travel 1 or travel 2 or say bye.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Kid, one thing y'should learn. Answer with {yes} or {no} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Sorry, come back later.")
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)

if you have problem, tell me or post in here.
 
Last edited:
travel for vocation?

exemple:

knight = {x = 1, y = 1, z = 1}
druid = {x = 2, y = 2, z = 2}
paladin = {x = 3, y = 3, z = 3}

etc?
 
check it
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, Town = {}, {}
local travel = {
	['travel1'] = {{x=1000, y=1000, z=7}},
	['travel 1'] = {{x=1000, y=1000, z=7}},
	['1'] = {{x=1000, y=1000, z=7}},
	['travel2']{{x=2000, y=2000, z=7}},
	['travel 2'] = {{x=2000, y=2000, z=7}},
	['2'] = {{x=2000, y=2000, z=7}},
}
 
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 thinkCallback(cid)
	if math.random(300) == 1 then
		npcHandler:say("Harr! Wanna go off this island? Need me an' my ship!")
	end
	return true
end
 
function creatureSayCallback(cid, type, msg)
local travel = travel[msg]
	if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
		local v, k = getPlayerVocation(cid), getCreatureName(cid)
		if v > 0 then
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
		npcHandler:addFocus(cid)
	elseif(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
		npcHandler:say("Bye, remember come back later.", cid, TRUE)
		Topic[cid] = nil
		Town[cid] = nil
		npcHandler:releaseFocus(cid)
	elseif Topic[cid] == 1 then
		if msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") then
			npcHandler:say("Are you sure the use travel 1?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("I only understand if you say travel 1 or travel 2." or "Kid, one thing y'should learn. Answer with {travel 1} or {travel 2} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = nil
		end
		elseif msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") and v == 0 then
			npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
			Topic[cid] = nil
		elseif msgcontains(msg, "travel 2") or msgcontains(msg, "travel2") or msgcontains(msg, "2") and v > 0 then
			npcHandler:say("Are you sure the use travel 2?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
			Topic[cid] = nill
			Town[cid] = nil
		end
	elseif Topic[cid] == 5 then
		if msgcontains(msg, 'yes') then
			npcHandler:say("Ok, nice travel.", cid)
			npcHandler:releaseFocus(cid)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, travel[1])
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			Topic[cid] = nil
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Choose travel 1 or travel 2 or say bye.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Kid, one thing y'should learn. Answer with {yes} or {no} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Sorry, come back later.")
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)

if you have problem, tell me or post in here.


[28/7/2012 11:36:54] [Error - LuaInterface::loadFile] data/npc/scripts/travel.lua:10: '=' expected near '{'
[28/7/2012 11:36:54] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/travel.lua
[28/7/2012 11:36:54] data/npc/scripts/travel.lua:10: '=' expected near '{'

- - - Updated - - -

travel for vocation?

exemple:

knight = {x = 1, y = 1, z = 1}
druid = {x = 2, y = 2, z = 2}
paladin = {x = 3, y = 3, z = 3}

etc?

NPC Check vocation.
vocation = travel
no vocation = no travel
 
Sorry, i have school and i can't help you, use this.

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, Town = {}, {}
local travel = {
	['travel1'] = {{x=1000, y=1000, z=7},
	['travel 1'] = {{x=1000, y=1000, z=7},
	['1'] = {{x=1000, y=1000, z=7},
	['travel2'] = {{x=2000, y=2000, z=7},
	['travel 2'] = {{x=2000, y=2000, z=7},
	['2'] = {{x=2000, y=2000, z=7}
}
 
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 thinkCallback(cid)
	if math.random(300) == 1 then
		npcHandler:say("Harr! Wanna go off this island? Need me an' my ship!")
	end
	return true
end
 
function creatureSayCallback(cid, type, msg)
local travel = travel[msg]
	if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
		local v, k = getPlayerVocation(cid), getCreatureName(cid)
		if v > 0 then
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
		npcHandler:addFocus(cid)
	elseif(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
		npcHandler:say("Bye, remember come back later.", cid, TRUE)
		Topic[cid] = nil
		Town[cid] = nil
		npcHandler:releaseFocus(cid)
	elseif Topic[cid] == 1 then
		if msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") then
			npcHandler:say("Are you sure the use travel 1?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("I only understand if you say travel 1 or travel 2." or "Kid, one thing y'should learn. Answer with {travel 1} or {travel 2} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = nil
		end
		elseif msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") and v == 0 then
			npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
			Topic[cid] = nil
		elseif msgcontains(msg, "travel 2") or msgcontains(msg, "travel2") or msgcontains(msg, "2") and v > 0 then
			npcHandler:say("Are you sure the use travel 2?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
			Topic[cid] = nill
			Town[cid] = nil
		end
	elseif Topic[cid] == 5 then
		if msgcontains(msg, 'yes') then
			npcHandler:say("Ok, nice travel.", cid)
			npcHandler:releaseFocus(cid)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, travel[1])
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			Topic[cid] = nil
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Choose travel 1 or travel 2 or say bye.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Kid, one thing y'should learn. Answer with {yes} or {no} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Sorry, come back later.")
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
 
[13/8/2012 6:22:49] [Error - LuaInterface::loadFile] data/npc/scripts/travel.lua:15: '}' expected (to close '{' at line 11) near 'function'
[13/8/2012 6:22:49] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/travel.lua
[13/8/2012 6:22:49] data/npc/scripts/travel.lua:15: '}' expected (to close '{' at line 11) near 'function'
 
Check, sorry i have school.

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, Town = {}, {}
local travel = {
	['travel1'] = {{x=1000, y=1000, z=7},
	['travel 1'] = {{x=1000, y=1000, z=7},
	['1'] = {{x=1000, y=1000, z=7},
	['travel2'] = {{x=2000, y=2000, z=7},
	['travel 2'] = {{x=2000, y=2000, z=7},
	['2'] = {{x=2000, y=2000, z=7}}
}
 
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 thinkCallback(cid)
	if math.random(300) == 1 then
		npcHandler:say("Harr! Wanna go off this island? Need me an' my ship!")
	end
	return true
end
 
function creatureSayCallback(cid, type, msg)
local travel = travel[msg]
	if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
		local v, k = getPlayerVocation(cid), getCreatureName(cid)
		if v > 0 then
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
		npcHandler:addFocus(cid)
	elseif(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
		npcHandler:say("Bye, remember come back later.", cid, TRUE)
		Topic[cid] = nil
		Town[cid] = nil
		npcHandler:releaseFocus(cid)
	elseif Topic[cid] == 1 then
		if msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") then
			npcHandler:say("Are you sure the use travel 1?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("I only understand if you say travel 1 or travel 2." or "Kid, one thing y'should learn. Answer with {travel 1} or {travel 2} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = nil
		end
		elseif msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") and v == 0 then
			npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
			Topic[cid] = nil
		elseif msgcontains(msg, "travel 2") or msgcontains(msg, "travel2") or msgcontains(msg, "2") and v > 0 then
			npcHandler:say("Are you sure the use travel 2?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
			Topic[cid] = nill
			Town[cid] = nil
		end
	elseif Topic[cid] == 5 then
		if msgcontains(msg, 'yes') then
			npcHandler:say("Ok, nice travel.", cid)
			npcHandler:releaseFocus(cid)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, travel[1])
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			Topic[cid] = nil
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Choose travel 1 or travel 2 or say bye.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Kid, one thing y'should learn. Answer with {yes} or {no} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Sorry, come back later.")
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
 
[18/8/2012 20:51:4] [Error - LuaInterface::loadFile] data/npc/scripts/travel.lua:15: '}' expected (to close '{' at line 11) near 'function'
[18/8/2012 20:51:4] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/travel.lua
[18/8/2012 20:51:4] data/npc/scripts/travel.lua:15: '}' expected (to close '{' at line 11) near 'function'
 
[18/8/2012 20:51:4] [Error - LuaInterface::loadFile] data/npc/scripts/travel.lua:15: '}' expected (to close '{' at line 11) near 'function'
[18/8/2012 20:51:4] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/travel.lua
[18/8/2012 20:51:4] data/npc/scripts/travel.lua:15: '}' expected (to close '{' at line 11) near 'function'

Code:
'}' expected (to close '{' at line 11) near 'function'
Dude, the server is telling what is wrong for you, just read it, you just have to place a braket at line 11... It cant be that hard...

you just have to change:
LUA:
	['travel 2'] = {{x=2000, y=2000, z=7},

to

LUA:
	['travel 2'] = {{x=2000, y=2000, z=7}},
 
MMM, my error sorry...

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, Town = {}, {}
local travel = {
	['travel1'] = {x=1000, y=1000, z=7},
	['travel 1'] = {x=1000, y=1000, z=7},
	['1'] = {x=1000, y=1000, z=7},
	['travel2'] = {x=2000, y=2000, z=7},
	['travel 2'] = {x=2000, y=2000, z=7},
	['2'] = {x=2000, y=2000, z=7}}

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 thinkCallback(cid)
	if math.random(300) == 1 then
		npcHandler:say("Harr! Wanna go off this island? Need me an' my ship!")
	end
	return true
end
 
function creatureSayCallback(cid, type, msg)
	local travel = travel[msg]
	if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
		local v, k = getPlayerVocation(cid), getCreatureName(cid)
		if v > 0 then
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
		npcHandler:addFocus(cid)
	elseif(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
		npcHandler:say("Bye, remember come back later.", cid, TRUE)
		Topic[cid] = nil
		Town[cid] = nil
		npcHandler:releaseFocus(cid)
	elseif Topic[cid] == 1 then
		if msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") then
			npcHandler:say("Are you sure the use travel 1?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("I only understand if you say travel 1 or travel 2." or "Kid, one thing y'should learn. Answer with {travel 1} or {travel 2} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = nil
		end
		elseif msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") and v == 0 then
			npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
			Topic[cid] = nil
		elseif msgcontains(msg, "travel 2") or msgcontains(msg, "travel2") or msgcontains(msg, "2") and v > 0 then
			npcHandler:say("Are you sure the use travel 2?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
			Topic[cid] = nill
			Town[cid] = nil
		end
	elseif Topic[cid] == 5 then
		if msgcontains(msg, 'yes') then
			npcHandler:say("Ok, nice travel.", cid)
			npcHandler:releaseFocus(cid)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, travel[1])
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			Topic[cid] = nil
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Choose travel 1 or travel 2 or say bye.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Kid, one thing y'should learn. Answer with {yes} or {no} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = 1
		end
	elseif msgcontains(msg, "fuck") then
	npcHandler:say("You are a very stupid.", cid)
	Topic[cid] = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Sorry, come back later.")
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
 
Last edited:
[19/8/2012 1:28:32] [Error - LuaInterface::loadFile] data/npc/scripts/travel.lua:65: 'end' expected (to close 'function' at line 26) near 'elseif'
[19/8/2012 1:28:32] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/travel.lua
[19/8/2012 1:28:32] data/npc/scripts/travel.lua:65: 'end' expected (to close 'function' at line 26) near 'elseif'
 
Check, use this

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, Town = {}, {}
local travel = {
	['travel1'] = {x=1000, y=1000, z=7},
	['travel 1'] = {x=1000, y=1000, z=7},
	['1'] = {x=1000, y=1000, z=7},
	['travel2'] = {x=2000, y=2000, z=7},
	['travel 2'] = {x=2000, y=2000, z=7},
	['2'] = {x=2000, y=2000, z=7}}
 
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 thinkCallback(cid)
	if math.random(300) == 1 then
		npcHandler:say("Harr! Wanna go off this island? Need me an' my ship!")
	end
	return true
end
 
function creatureSayCallback(cid, type, msg)
	local travel = travel[msg]
	if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
		local v, k = getPlayerVocation(cid), getCreatureName(cid)
		if v > 0 then
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
		npcHandler:addFocus(cid)
	elseif(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
		npcHandler:say("Bye, remember come back later.", cid, TRUE)
		Topic[cid] = nil
		Town[cid] = nil
		npcHandler:releaseFocus(cid)
	elseif Topic[cid] == 1 then
		if msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") then
			npcHandler:say("Are you sure the use travel 1?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("I only understand if you say travel 1 or travel 2." or "Kid, one thing y'should learn. Answer with {travel 1} or {travel 2} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = nil
		end
		elseif msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") and v == 0 then
			npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
			Topic[cid] = nil
		elseif msgcontains(msg, "travel 2") or msgcontains(msg, "travel2") or msgcontains(msg, "2") and v > 0 then
			npcHandler:say("Are you sure the use travel 2?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
			Topic[cid] = nill
			Town[cid] = nil
		end
	elseif Topic[cid] == 5 then
		if msgcontains(msg, 'yes') then
			npcHandler:say("Ok, nice travel.", cid)
			npcHandler:releaseFocus(cid)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, travel[1])
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			Topic[cid] = nil
		else
			npcHandler:say("You only need say {yes} or {no}.", cid)
			Topic[cid] = 5
		end
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Choose travel 1 or travel 2 or say bye.", cid)
			Topic[cid] = 1
	elseif msgcontains(msg, "fuck") then
	npcHandler:say("You are a very stupid.", cid)
	Topic[cid] = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Sorry, come back later.")
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
 
Last edited:
[Error - LuaInterface::loadFile] data/npc/scripts/travel.lua:65: 'end' expected (to close 'function' at line 26) near 'elseif'
[19/8/2012 19:1:50] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/travel.lua
[19/8/2012 19:1:50] data/npc/scripts/travel.lua:65: 'end' expected (to close 'function' at line 26) near 'elseif'
 
Check this

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, Town = {}, {}
local travel = {
	['travel1'] = {x=1000, y=1000, z=7},
	['travel 1'] = {x=1000, y=1000, z=7},
	['1'] = {x=1000, y=1000, z=7},
	['travel2'] = {x=2000, y=2000, z=7},
	['travel 2'] = {x=2000, y=2000, z=7},
	['2'] = {x=2000, y=2000, z=7}}
 
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)
	local travel = travel[msg]
	if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
		local v, k = getPlayerVocation(cid), getCreatureName(cid)
		if v > 0 then
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
		npcHandler:addFocus(cid)
	elseif(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
		npcHandler:say("Bye, remember come back later.", cid, TRUE)
		Topic[cid] = nil
		Town[cid] = nil
		npcHandler:releaseFocus(cid)
	elseif Topic[cid] == 1 then
		if msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") then
			npcHandler:say("Are you sure the use travel 1?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("I only understand if you say travel 1 or travel 2." or "Kid, one thing y'should learn. Answer with {travel 1} or {travel 2} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = nil
		end
	elseif msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") and v == 0 then
		npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
		Topic[cid] = nil
	end
	elseif msgcontains(msg, "travel 2") or msgcontains(msg, "travel2") or msgcontains(msg, "2") and v > 0 then
		npcHandler:say("Are you sure the use travel 2?.", cid)
		Topic[cid] = 5
	else
		npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
		Topic[cid] = nill
		Town[cid] = nil
	end
	elseif Topic[cid] == 5 then
		if msgcontains(msg, 'yes') then
			npcHandler:say("Ok, nice travel.", cid)
			npcHandler:releaseFocus(cid)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, travel[msg])
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			Topic[cid] = nil
		else
			npcHandler:say("You only need say {yes} or {no}.", cid)
			Topic[cid] = 5
		end
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Choose travel 1 or travel 2 or say bye.", cid)
			Topic[cid] = 1
		end
	elseif msgcontains(msg, "fuck") then
	npcHandler:say("You are a very stupid.", cid)
	Topic[cid] = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Sorry, come back later.")
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)

Or use this

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, Town = {}, {}
local travel = {
	['travel1'] = {x=1000, y=1000, z=7},
	['travel 1'] = {x=1000, y=1000, z=7},
	['1'] = {x=1000, y=1000, z=7},
	['travel2'] = {x=2000, y=2000, z=7},
	['travel 2'] = {x=2000, y=2000, z=7},
	['2'] = {x=2000, y=2000, z=7}}
 
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 onCreatureSay(cid, type, msg)
	local travel = travel[msg]
	if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
		local v, k = getPlayerVocation(cid), getCreatureName(cid)
		if v > 0 then
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
		npcHandler:addFocus(cid)
	elseif(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
		npcHandler:say("Bye, remember come back later.", cid, TRUE)
		Topic[cid] = nil
		Town[cid] = nil
		npcHandler:releaseFocus(cid)
	elseif Topic[cid] == 1 then
		if msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") then
			npcHandler:say("Are you sure the use travel 1?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("I only understand if you say travel 1 or travel 2." or "Kid, one thing y'should learn. Answer with {travel 1} or {travel 2} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = nil
		end
	elseif msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") and v == 0 then
		npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
		Topic[cid] = nil
	end
	elseif msgcontains(msg, "travel 2") or msgcontains(msg, "travel2") or msgcontains(msg, "2") and v > 0 then
		npcHandler:say("Are you sure the use travel 2?.", cid)
		Topic[cid] = 5
	else
		npcHandler:say("You dont have vocation, please come back another day [stupid]!", cid)
		Topic[cid] = nill
		Town[cid] = nil
	end
	elseif Topic[cid] == 5 then
		if msgcontains(msg, 'yes') then
			npcHandler:say("Ok, nice travel.", cid)
			npcHandler:releaseFocus(cid)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, travel)
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			Topic[cid] = nil
		else
			npcHandler:say("You only need say {yes} or {no}.", cid)
			Topic[cid] = 5
		end
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Choose travel 1 or travel 2 or say bye.", cid)
			Topic[cid] = 1
		end
	elseif msgcontains(msg, "fuck") then
	npcHandler:say("You are a very stupid.", cid)
	Topic[cid] = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Sorry, come back later.")
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
 
Sorry, i use the script and need fix...

Test it, and say me if work.

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, Town = {}, {}
local travel = {
	['travel1'] = {x=1000, y=1000, z=7},
	['travel 1'] = {x=1000, y=1000, z=7},
	['1'] = {x=1000, y=1000, z=7},
	['travel2'] = {x=2000, y=2000, z=7},
	['travel 2'] = {x=2000, y=2000, z=7},
	['2'] = {x=2000, y=2000, z=7}}
 
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 v = getPlayerVocation(cid)
 
function creatureSayCallback(cid, type, msg)
	local travel = travel[msg]
	if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
		local v, k = getPlayerVocation(cid), getCreatureName(cid)
		if v > 0 then
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Hello " .. k .. ", what travel need you travel 1 or travel 2?.", cid)
			Topic[cid] = 1
		end
		Town[cid] = nil
		npcHandler:addFocus(cid)
	elseif(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
		npcHandler:say("Bye, remember come back later.", cid, TRUE)
		Topic[cid] = nil
		Town[cid] = nil
		npcHandler:releaseFocus(cid)
	elseif Topic[cid] == 1 then
		if msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") then
			npcHandler:say("Are you sure the use travel 1?.", cid)
			Topic[cid] = 5
		else
			npcHandler:say("I only understand if you say travel 1 or travel 2." or "Kid, one thing y'should learn. Answer with {travel 1} or {travel 2} and ya'll get much farther than with random babbling.", cid)
			Topic[cid] = 1
	elseif msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") and v == 0 then
		npcHandler:say("You dont have vocation, please come back another day {stupid}!", cid)
		Topic[cid] = nil
		npcHandler:releaseFocus(cid)
	elseif msgcontains(msg, "travel 2") or msgcontains(msg, "travel2") or msgcontains(msg, "2") and v > 0 then
		npcHandler:say("Are you sure the use travel 2?.", cid)
		Topic[cid] = 5
	else
		npcHandler:say("You dont have vocation, please come back another day {stupid}!", cid)
		Topic[cid] = nill
		Town[cid] = nil
	end
	elseif Topic[cid] == 5 then
		if msgcontains(msg, 'yes') then
			npcHandler:say("Ok, nice travel.", cid)
			npcHandler:releaseFocus(cid)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, travel[msg])
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			Topic[cid] = nil
		else
			npcHandler:say("You only need say {yes} or {no}.", cid)
			Topic[cid] = 5
		elseif msgcontains(msg, 'no') then
			npcHandler:say("Choose travel 1 or travel 2 or say bye.", cid)
			Topic[cid] = 1
		end
	elseif msgcontains(msg, "fuck") then
	npcHandler:say("You are a very stupid.", cid)
	Topic[cid] = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Sorry, come back later.")
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
 
Last edited:
Al fin lo termine :D me tuve que buscar el oracle de tibia rl actual y modificarlo asi que veras que tiene contenido extra pero cumple con las funciones que tu quieres... solo cambia la LUA por la siguiente -->

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, vocation, town, destination = {}, {}, {}, {}
local TOWN_ISLANDOFDESTINY = 1
local islandOfDestinyEnabled = true
 
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 greetCallback(cid)
	if(getPlayerVocation(cid) < 1) then
		npcHandler:say("CHILD! COME BACK WHEN YOU HAVE VOCATION!!!", cid)
		return false
	else
		local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
		Topic[talkUser], vocation[talkUser], town[talkUser], destination[talkUser] = 0, 0, 0, 0
		return true
	end
end
 
function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	if(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "yes") and Topic[talkUser] == 0 then
		npcHandler:say(islandOfDestinyEnabled and "I WILL BRING YOU TO THE CONTINENT ARE YOU SURE?!!" or "IN WHICH TOWN DO YOU WANT TO LIVE: {CARLIN}, {AB'DENDRIEL}, {KAZORDOON}" .. (isPremium(cid) == TRUE and ", {THAIS}, {VENORE}, {DARASHIA}, {ANKRAHMUN}, {EDRON} OR {PORT HOPE}?" or " OR {THAIS}?"), cid)
		Topic[talkUser] = islandOfDestinyEnabled and 4 or 1
	elseif Topic[talkUser] == 0 then
		npcHandler:unGreet(cid)
	elseif msgcontains(msg, "carlin") and Topic[talkUser] == 1 then
		npcHandler:say("IN CARLIN! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
		Topic[talkUser] = 2
		town[talkUser] = 2
		destination[talkUser] = {x=32360, y=31782, z=7}
	elseif msgcontains(msg, "ab'dendriel") and Topic[talkUser] == 1 then
		npcHandler:say("IN AB'DENDRIEL! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
		Topic[talkUser] = 2
		town[talkUser] = 3
		destination[talkUser] = {x=32732, y=31634, z=7}
	elseif msgcontains(msg, "kazordoon") and Topic[talkUser] == 1 then
		npcHandler:say("IN KAZORDOON! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
		Topic[talkUser] = 2
		town[talkUser] = 4
		destination[talkUser] = {x=32649, y=31925, z=11}
	elseif msgcontains(msg, "thais") and Topic[talkUser] == 1 then
		npcHandler:say("IN THAIS! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
		Topic[talkUser] = 2
		town[talkUser] = 5
		destination[talkUser] = {x=32369, y=32241, z=7}
	elseif msgcontains(msg, "venore") and Topic[talkUser] == 1 then
		npcHandler:say("IN VENORE! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
		Topic[talkUser] = 2
		town[talkUser] = 6
		destination[talkUser] = {x=32957, y=32076, z=7}
	elseif msgcontains(msg, "darashia") and Topic[talkUser] == 1 then
		if isPremium(cid) == TRUE then
			npcHandler:say("IN DARASHIA! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
			Topic[talkUser] = 2
			town[talkUser] = 7
			destination[talkUser] = {x=33213, y=32454, z=1}
		else
			npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
			Topic[talkUser] = 1
		end
	elseif msgcontains(msg, "ankrahmun") and Topic[talkUser] == 1 then
		if isPremium(cid) == TRUE then
			npcHandler:say("IN ANKRAHMUN! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
			Topic[talkUser] = 2
			town[talkUser] = 8
			destination[talkUser] = {x=33194, y=32853, z=8}
		else
			npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
			Topic[talkUser] = 1
		end
	elseif msgcontains(msg, "edron") and Topic[talkUser] == 1 then
		if isPremium(cid) == TRUE then
			npcHandler:say("IN EDRON! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
			Topic[talkUser] = 2
			town[talkUser] = 9
			destination[talkUser] = {x=33217, y=31814, z=8}
		else
			npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
			Topic[talkUser] = 1
		end
	elseif msgcontains(msg, "port") and msgcontains(msg, "hope") and Topic[talkUser] == 1 then
		if isPremium(cid) == TRUE then
			npcHandler:say("IN PORT HOPE! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
			Topic[talkUser] = 2
			town[talkUser] = 10
			destination[talkUser] = {x=32595, y=32744, z=6}
		else
			npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
			Topic[talkUser] = 1
		end
	elseif Topic[talkUser] == 1 then
		npcHandler:say("{CARLIN}, {AB'DENDRIEL}, {KAZORDOON}" .. (isPremium(cid) == TRUE and ", {THAIS}, {VENORE}, {DARASHIA}, {ANKRAHMUN}, {EDRON} OR {PORT HOPE}?" or " OR {THAIS}?"), cid)
		Topic[talkUser] = 1
	elseif msgcontains(msg, "sorcerer") and Topic[talkUser] == 2 then
		npcHandler:say("A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
		Topic[talkUser] = 3
		vocation[talkUser] = 1
	elseif msgcontains(msg, "druid") and Topic[talkUser] == 2 then
		npcHandler:say("A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
		Topic[talkUser] = 3
		vocation[talkUser] = 2
	elseif msgcontains(msg, "paladin") and Topic[talkUser] == 2 then
		npcHandler:say("A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
		Topic[talkUser] = 3
		vocation[talkUser] = 3
	elseif msgcontains(msg, "knight") and Topic[talkUser] == 2 then
		npcHandler:say("A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
		Topic[talkUser] = 3
		vocation[talkUser] = 4
	elseif Topic[talkUser] == 2 then
		npcHandler:say("{KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
		Topic[talkUser] = 2
	elseif msgcontains(msg, "yes") and Topic[talkUser] == 3 then
		npcHandler:say("SO BE IT!", cid)
		Topic[talkUser] = 0
		doPlayerSetVocation(cid, vocation[talkUser])
		doPlayerSetTown(cid, town[talkUser])
		npcHandler:releaseFocus(cid)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
		doTeleportThing(cid, destination[talkUser])
		doSendMagicEffect(destination[talkUser], CONST_ME_TELEPORT)
	elseif Topic[talkUser] == 3 then
		npcHandler:unGreet(cid)
	elseif Topic[talkUser] == 4 then
		if msgcontains(msg, "yes") then
			npcHandler:say("SO BE IT!", cid)
			Topic[talkUser] = 0
			npcHandler:releaseFocus(cid)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, {x=1000,y=1000,z=7})
			doSendMagicEffect({x=1000,y=1000,z=7}, CONST_ME_TELEPORT)
		else
			npcHandler:unGreet(cid)
		end
	end
	return TRUE
end
 
npcHandler:setMessage(MESSAGE_GREET, "|PLAYERNAME|, YOU NEED TRAVEL??")
npcHandler:setMessage(MESSAGE_WALKAWAY, "COME BACK WHEN YOU ARE PREPARED!")
npcHandler:setMessage(MESSAGE_FAREWELL, "COME BACK WHEN YOU ARE PREPARED!")
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


Cualquier cosa me vuelves a decir.. si queires añadirle mas funciones o algo ;)
 
Back
Top