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
Captain Kurt (script by Cykotitan)
Captain Kurt.xml
iodship.lua
Sorcerer Estrella
sorcerer estrella.xml
iodsorcerer.lua
Knight Hykrion
knight hykrion.xml
iodknight.lua
Paladin Narai
paladin narai.xml
iodpaladin.lua
Druid Yandur
druid yandur.xml
ioddruid.lua
Raffael.xml
Dungeon Scrpit (example: druid dungeon)
set action id "2222"
add in movements.xml
druid.lua (newpos not used) (blue vocation ids druid 2,6,10 for knights 4,8,12)
IoD NPCS zip
Please report any bugs.
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)
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())
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())
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())
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())
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>
Dungeon Scrpit (example: druid dungeon)
set action id "2222"
add in movements.xml
Code:
<movevent type="StepIn" actionid="2222" event="script" value="druid.lua"/>
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
Please report any bugs.
Last edited: