Postado Setembro 12, 2014 12 anos Eu queria um NPC que troca vocation. Ou seja, eu dou um item pra ele e ele me da uma vocation. OTVersao 8.00. I helped you ? REP +. Att: Abreu
Postado Setembro 12, 2014 12 anos Boa tarde. Teste este: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid ----------------------- CONFIG ITENS ---------------------- local voc = X -- id da vocação local item = {5890, 100} -- Item, Quantidade local premmy = "true" -- true/false (somente premium?) ----------------------- MESSAGENS -------------------------- if (msgcontains(msg, 'ajuda') or msgcontains(msg, 'help')) then selfSay('Olá, posso promever sua vocação por {'..item[2]..' '..item[1]..'}, se houver interesse diga {promote}.', cid) elseif (msgcontains(msg, 'promote') or msgcontains(msg, 'promotion')) then selfSay('Voce tem '..item[2]..' '..getItemNameById(item[1])..' para me oferecer em troca da vocação '..getVocationInfo(voc)..'?', cid) talkState[talkUser] = 3 ---------------------- NEGOCIAÇÃO -------------------------- elseif talkState[talkUser] == 3 then if (msgcontains(msg, 'sim') or msgcontains(msg, 'yes')) then if premmy == "true" and isPremium(cid) == true then if getPlayerItemCount(cid, item[1]) >= item[2] then doPlayerRemoveItem(cid, item[1], item[2]) doPlayerSetVocation(cid, voc) selfSay('Parabéns, agora você é um '..getVocationInfo(voc)..'.', cid) else selfSay('Voce nao tem os itens necessarios.', cid) talkState[talkUser] = 0 end else selfSay('Esta missao eh apenas para Premium Account.', cid) talkState[talkUser] = 0 end end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Boa sorte. Retorne para dizer se funcionou. Gosta do meu trabalho? Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs. Atenciosamente,Adriano Swatt' Para ver meus tutoriais acesse meu perfil.
Postado Outubro 13, 2016 10 anos Teria como adicionar verificação de sexo, se ele for male troca pra X vocation e muda para X outfit quando concluir a missao, se for female é X vocation e X outfit
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.