Postado Agosto 9, 2014 10 anos Olá. Tibia versão: 8.60 Executavel: TFS 4.0 Script: .lua Dou rep+ pra quem ajudar. Gostaria que o player compra-se a promotion por 2 itens ao invés de comprar por 20k. ID DOS ITENS: (2157) e (2328) Obs: o player precisa ter 100 de cada item. Script do NPC.lua Abaixo. 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 local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce tem 100 promotion golds e 100 promotion fire souls?'}) node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0, items = {{2157,100}, {2328,100}}, level = 8, promotion = 1, text = 'Parabens! Agora você é promotion.'}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true}) npcHandler:addModule(FocusModule:new())
Postado Agosto 9, 2014 10 anos Não sei fazer este código poís não mecho muito com NPCS, Desculpe =/ ~Veja meus tópicos =D → Pokémon Zot Editado por Factur Final 80% → Quando poke morrer abrir TP por 30 segundos → Aumentando velocidade do player → Como criar cliente próprio (Com imagens) → Como criar uma quest (por SCRIPT) → Editando pokémons → [TinyTask] Explicação e tudo que você deve saber. → Adicionando o comando !bug → Adicionando o comando /buykit ~Projeto Antes e Depois ~~ → Umbreon - Antes e depois #1 → Esquilo - Antes e depois (Especial Snowsz)#2 → Lobo - Antes e Depois #3 → Entei - Antes e Depois #4 → Yveltal - Antes e Depois #5 → Morte - Antes e Depois #6
Postado Agosto 10, 2014 10 anos Solução Bom dia. Abaixo segue o script: 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 ---------- Início das Configurações ---------- local item1 = {2157, 100} -- Id e Quantidade local item2 = {2328, 100} -- Id e Quantidade local get = getItemNameById ---------- Fim das Configurações -------------- if msgcontains(msg, 'promote') or msgcontains(msg, 'promotion') then selfSay('Deseja ser promovido pagando '..item1[2]..' '..get(item1[1])..' e '..item2[2]..' '..get(item2[1])..'?', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'sim') or msgcontains(msg, 'yes') then if getPlayerItemCount(cid, item1[1]) >= item1[2] and getPlayerItemCount(cid, item2[1]) >= item2[2] then doPlayerRemoveItem(cid, item1[1], item1[2]) doPlayerRemoveItem(cid, item2[1], item2[2]) doSendMagicEffect(getCreaturePosition(cid), 14) setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid)+1) selfSay('Parabens agora voce e um(a) '..getPlayerVocationName(getPlayerVocation(cid))..'!', cid) else selfSay('voce nao tem os items exigidos.', cid) talkState[talkUser] = 0 end end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Obs: Testado e funcionando perfeitamente em 0.3.6, porém, creio que funcione com você também. Boa sorte. 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.
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.