• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC Island Of Destiny NPCs and Oracle

dualshock3

New Member
Joined
May 14, 2010
Messages
89
Reaction score
3
Island Of Destiny NPCs works on tfs 0.3.6.3429
after several hours of testing, i finally did it, i fixed the vocation NPCS
The Oracle:
http://otland.net/f83/oracle-44113/#post445656
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, vocation, town, destination = {}, {}, {}, {}
[COLOR="red"]local TOWN_ISLANDOFDESTINY = 16
local islandOfDestinyEnabled = false[/COLOR]

Captain Kurt (script by Cykotitan)
Captain Kurt.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Kurt" script="data/npc/scripts/iodship.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="96" head="0" body="0" legs="0" feet="0" addons="0"/>
    	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|."/>
        <parameter key="message_farewell" value="Good bye."/>
		<parameter key="message_walkaway" value="Farewell then.." />
    </parameters>
</npc>

iodship.lua

Code:
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)
7951-kurt.jpg


Sorcerer Estrella
sorcerer estrella.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Sorcerer Estrella" script="data/npc/scripts/iodsorcerer.lua" walkinterval="20000" floorchange="0">
    <health now="100" max="100"/>
    <look type="149" head="59" body="132" legs="94" feet="114" addons="3"/>
    	<parameters>
		<parameter key="message_greet" value="Hi |PLAYERNAME|. are you interested in sorcerer vocation, {Ok}?."/>
	</parameters>
</npc>

iodsorcerer.lua
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
 
item = 'You do not have the required Level or You Already have a Vocation!.'
done = 'Congratulations now you are sorcerer, Go to the dungeon and take your items and hunt.'
 
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	if msgcontains(msg, 'ok') then
		selfSay('Do you Want to become a sorcerer?', cid)
	elseif msgcontains(msg, 'yes') then
                        if(getPlayerLevel(cid) > 1) then                   
			selfSay('Say it Proudly: Yes, I Want to Become a sorcerer!', cid)
			talk_state = 1
		else
			selfSay('You do not have the required Level or You Already have a Vocation!.', cid)
			talk_state = 0
		end
	elseif msgcontains(msg, 'sorcerer') and talk_state == 1 then
		talk_state = 0
                if getCreatureStorage(cid, 43211) == 1 == FALSE then
			selfSay(done, cid)
			doPlayerSetVocation(cid, 1)
                        setPlayerStorageValue(cid, 43211,1)
                        doSendMagicEffect(getCreaturePosition(cid), 14)
		else
			selfSay(item, cid)
		end
	elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
		selfSay('Ok than.')
		talk_state = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
7952-sorcerer.jpg


Knight Hykrion
knight hykrion.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Knight Hykrion" script="data/npc/scripts/iodknight.lua" walkinterval="20000" floorchange="0">
    <health now="100" max="100"/>
    <look type="131" head="95" body="78" legs="78" feet="95" addons="3"/>
    	<parameters>
		<parameter key="message_greet" value="Hi |PLAYERNAME|. are you interested in knight vocation, {Ok}?."/>
	</parameters>
</npc>

iodknight.lua
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
 
item = 'You do not have the required Level or You Already have a Vocation!.'
done = 'Congratulations now you are knight, Go to the dungeon and take your items and hunt.'
 
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	if msgcontains(msg, 'ok') then
		selfSay('Do you Want to become a knight?', cid)
	elseif msgcontains(msg, 'yes') then
                        if(getPlayerLevel(cid) > 1) then                   
			selfSay('Say it Proudly: Yes, I Want to Become a knight!', cid)
			talk_state = 1
		else
			selfSay('You do not have the required Level or You Already have a Vocation!.', cid)
			talk_state = 0
		end
	elseif msgcontains(msg, 'knight') and talk_state == 1 then
		talk_state = 0
                if getCreatureStorage(cid, 43211) == 1 == FALSE then
			selfSay(done, cid)
			doPlayerSetVocation(cid, 4)
                        setPlayerStorageValue(cid, 43211,1)
                        doSendMagicEffect(getCreaturePosition(cid), 14)
		else
			selfSay(item, cid)
		end
	elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
		selfSay('Ok than.')
		talk_state = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
7954-knight.jpg


Paladin Narai
paladin narai.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Paladin Narai" script="data/npc/scripts/iodpaladin.lua" walkinterval="20000" floorchange="0">
    <health now="100" max="100"/>
    <look type="137" head="114" body="63" legs="0" feet="112" addons="3"/>
    	<parameters>
		<parameter key="message_greet" value="Hi |PLAYERNAME|. are you interested in paladin vocation, {Ok}?."/>
	</parameters>
</npc>

iodpaladin.lua
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
 
item = 'You do not have the required Level or You Already have a Vocation!.'
done = 'Congratulations now you are paladin, Go to the dungeon and take your items and hunt.'
 
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	if msgcontains(msg, 'ok') then
		selfSay('Do you Want to become a paladin?', cid)
	elseif msgcontains(msg, 'yes') then
                        if(getPlayerLevel(cid) > 1) then                   
			selfSay('Say it Proudly: Yes, I Want to Become a paladin!', cid)
			talk_state = 1
		else
			selfSay('You do not have the required Level or You Already have a Vocation!.', cid)
			talk_state = 0
		end
	elseif msgcontains(msg, 'paladin') and talk_state == 1 then
		talk_state = 0
                if getCreatureStorage(cid, 43211) == 1 == FALSE then
			selfSay(done, cid)
			doPlayerSetVocation(cid, 3)
                        setPlayerStorageValue(cid, 43211,1)
                        doSendMagicEffect(getCreaturePosition(cid), 14)
		else
			selfSay(item, cid)
		end
	elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
		selfSay('Ok than.')
		talk_state = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
7955-paladin.jpg


Druid Yandur
druid yandur.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Druid Yandur" script="data/npc/scripts/ioddruid.lua" walkinterval="20000" floorchange="0">
    <health now="100" max="100"/>
    <look type="144" head="115" body="115" legs="132" feet="115" addons="3"/>
    	<parameters>
		<parameter key="message_greet" value="Hi |PLAYERNAME|. are you interested in druid vocation, {Ok}?."/>
	</parameters>
</npc>

ioddruid.lua
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
 
item = 'You do not have the required Level or You Already have a Vocation!.'
done = 'Congratulations now you are druid, Go to the dungeon and take your items and hunt.'
 
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	if msgcontains(msg, 'ok') then
		selfSay('Do you Want to become a druid?', cid)
	elseif msgcontains(msg, 'yes') then
                        if(getPlayerLevel(cid) > 1) then                   
			selfSay('Say it Proudly: Yes, I Want to Become a druid!', cid)
			talk_state = 1
		else
			selfSay('You do not have the required Level or You Already have a Vocation!.', cid)
			talk_state = 0
		end
	elseif msgcontains(msg, 'druid') and talk_state == 1 then
		talk_state = 0
                if getCreatureStorage(cid, 43211) == 1 == FALSE then
			selfSay(done, cid)
			doPlayerSetVocation(cid, 2)
                        setPlayerStorageValue(cid, 43211,1)
                        doSendMagicEffect(getCreaturePosition(cid), 14)
		else
			selfSay(item, cid)
		end
	elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
		selfSay('Ok than.')
		talk_state = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
7953-druid.jpg


Raffael.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Raffael" script="default.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="128" head="120" body="39" legs="115" feet="119" addons="3"/>
    	<parameters>
		<parameter key="module_shop" value="1"/>
		<parameter key="message_greet" value="Hi |PLAYERNAME|. I sell Basic equipments. Say {trade}."/>
		<parameter key="shop_buyable" value="backpack,1988,20;pick,2553,10;shovel,2554,20;rope,2120,50;health,7618,45;mana,7620,50"/>
	</parameters>
</npc>
7950-raffael.jpg


Dungeon Scrpit (example: druid dungeon)
set action id "2222"
7949-ddungeon.jpg

add in movements.xml
Code:
<movevent type="StepIn" actionid="2222" event="script" value="druid.lua"/>
druid.lua (newpos not used) (blue vocation ids druid 2,6,10 for knights 4,8,12)
Code:
function onStepIn(cid, item, position, fromPosition)
 
	local [COLOR="red"]newPos[/COLOR] = {x = 33427, y = 31829, z = 13}
	local vocation = {[COLOR="blue"]2, 6, 10[/COLOR]}
 
	if(isInArray(vocation, getPlayerVocation(cid)) == true) then
		doTeleportThing(cid, newPos)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) 
	else
		doTeleportThing(cid, fromPosition)
		doSendMagicEffect(getCreaturePosition(cid), 2)
		doPlayerSendTextMessage(0, cid, 22, 'Only druids may enter here.') 
	end
end
IoD NPCS zip
Please report any bugs.
 
Last edited:
"Hi |PLAYERNAME|. I sell Basic equipments. Say {trade}."

I'm pretty sure he doesn't say equipments.

Other than a quick scan looking through, looks good. I like captain kurt the best.
 
Hi, thank you for scripts. I have this error:

17:11 Knight Hykrion: Hi Azzkara. are you interested in knight vocation, Ok?.
17:11 Azzkara [8]: ok
17:11 Knight Hykrion: Do you Want to become a knight?
17:11 Azzkara [8]: yes
17:11 Knight Hykrion: Say it Proudly: Yes, I Want to Become a knight!
17:11 Azzkara [8]: knight
17:11 Knight Hykrion: Congratulations now you are druid, Go to the dungeon and take your items and hunt.


But:
17:14 Azzkara is looking at you.
17:14 You see yourself. You are a knight.
 
I lol'd when i saw that ^. "are you sure you want to be a knight"
"yes"
"But are you really sure? why not be a druid instead?
"KNIGHT!"
"knights suck, c'mon! Be a druid! You know you want to!"
"KNIGHHHHHTTT!"
"aff, say it proudly then!"
"KNIGHT NAO!"
"congratz. YOU ARE A DRUID!"

ahahsahshahshahsah Thats a par! :p
 
It doesn't work for TFS 0.2.14 :(, can somebody maybe edit the Knight trainer script? Thanks in advance!

Transcript:

17:07 Knight Trainer: Hello, Qewr. Are you prepared to face your destiny?
17:07 Qewr [8]: yes
17:07 Knight Trainer: Say it Proudly: Yes, I Want to Become a knight!
17:07 Qewr [8]: Yes, I Want to Become a knight!

--silence--
 
Back
Top