eu criei vocações , do 9 ao 13 , é q eu tô fazendo um server de narutibia 8.54
meu npc :
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic, vocation, town, destination = {}, {}, {}, {}
local TOWN_ISLANDOFDESTINY = 16
local islandOfDestinyEnabled = false
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(getPlayerLevel(cid) < 8) then
npcHandler:say("Criança! Volte quando você estiver crescida!", cid)
return false
elseif(getPlayerVocation(cid) > 0) then
npcHandler:say("Você e muito forte.", 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("Eu recruto pessoas para {Konoha}.", cid)
Topic[talkUser] = islandOfDestinyEnabled and 4 or 1
elseif Topic[talkUser] == 0 then
npcHandler:unGreet(cid)
elseif msgcontains(msg, "konoha") and Topic[talkUser] == 1 then
npcHandler:say("Você quer ser um {Uzumaki}, {Uchiha}, {Nara}, {Aburame} ou {Hyuuga}?", cid)
Topic[talkUser] = 2
town[talkUser] = 2
destination[talkUser] = {x=388, y=117, z=7}
elseif Topic[talkUser] == 1 then
npcHandler:say("Eu recruto pessoas para {KONOHA}.", cid)
Topic[talkUser] = 1
elseif msgcontains(msg, "uzumaki") and Topic[talkUser] == 2 then
npcHandler:say("Tem certeza? Sua decisão é irreversível.", cid)
Topic[talkUser] = 3
vocation[talkUser] = 9
elseif msgcontains(msg, "uchiha") and Topic[talkUser] == 2 then
npcHandler:say("Tem certeza? Sua decisão é irreversível.", cid)
Topic[talkUser] = 3
vocation[talkUser] = 10
elseif msgcontains(msg, "nara") and Topic[talkUser] == 2 then
npcHandler:say("Tem certeza? Sua decisão é irreversível.", cid)
Topic[talkUser] = 3
vocation[talkUser] = 11
elseif msgcontains(msg, "aburame") and Topic[talkUser] == 2 then
npcHandler:say("Tem certeza? Sua decisão é irreversível.", cid)
Topic[talkUser] = 3
vocation[talkUser] = 12
elseif msgcontains(msg, "hyuuga") and Topic[talkUser] == 2 then
npcHandler:say("Tem certeza? Sua decisão é irreversível.", cid)
Topic[talkUser] = 3
vocation[talkUser] = 13
elseif Topic[talkUser] == 2 then
npcHandler:say("Você quer ser um {Uzumaki}, {Uchiha}, {Nara}, {Aburame} ou {Hyuuga}?", cid)
Topic[talkUser] = 2
elseif msgcontains(msg, "yes") and Topic[talkUser] == 3 then
npcHandler:say("É isso!", 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
doPlayerSetTown(cid, TOWN_ISLANDOFDESTINY)
npcHandler:releaseFocus(cid)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doTeleportThing(cid, {x=32091,y=32027,z=7})
doSendMagicEffect({x=32091,y=32027,z=7}, CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Welcome to the Island of Destiny. Walk north to find trainers who will help you find a suitable vocation.")
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "The surface of this island is a protection zone. You can't attack or regain health here. If you need healing, talk to Yandur.")
doAddMapMark(cid, {x=32099,y=31996,z=7}, MAPMARK_EXCLAMATION, "Island of Destiny - Training Centre")
doAddMapMark(cid, {x=32098,y=31986,z=7}, MAPMARK_GREENNORTH, "Ship to Mainland")
else
npcHandler:unGreet(cid)
end
end
return TRUE
end
npcHandler:setMessage(MESSAGE_GREET, "|PLAYERNAME|, Você está preparado para encarar o seu destino ?")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Volte quando estiver preparado!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Volte quando estiver preparado!")
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
ele troca de vocação , mas se eu deslogar e logar devolta ele volta pra vocação 0
daí eu fiquei com raiva e fiz uma talkaction pra ver se o npc tava bugado , mas acontece a mesma coisa .É esse script :
function onSay(cid, words, param, channel)
doPlayerSetVocation(cid,10)
end