Postado Agosto 27, 2014 10 anos Autor [27/08/2014 13:44:59] [Error - Npc interface] [27/08/2014 13:44:59] data/npc/scripts/toddy.lua [27/08/2014 13:44:59] Description: [27/08/2014 13:44:59] data/lib/050-function.lua:239: attempt to index a boolean value [27/08/2014 13:44:59] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/toddy.lua ai o erro
Postado Agosto 27, 2014 10 anos Abra o arquivo toddy.lua e cole este código dentro. 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 diamonds = {2159, 100} -- id, quantidade local moeda = {2160, 100} -- id, quantidade ------------------ MESSAGENS -------------------------- if (msgcontains(msg, 'trocar') or msgcontains(msg, 'trade')) then selfSay('Deseja trocar '..diamonds[2]..' '..getItemNameById(diamonds[1])..' por '..moeda[2]..' '..getItemNameById(moeda[1])..'?', cid) talkState[talkUser] = 3 ---------------------- NEGOCIAÇÃO --------------------------------------- elseif talkState[talkUser] == 3 then if (msgcontains(msg, 'sim') or msgcontains(msg, 'yes')) then if getPlayerItemCount(cid, diamonds[1]) >= diamonds[2] then doPlayerRemoveItem(cid, diamonds[1], diamonds[2]) doPlayerAddItem(cid, moeda[1], moeda[2]) selfSay('Obrigado, foi bom fazer negocio com voce', cid) else selfSay('Voce nao tem '..diamonds[2]..' '..getItemNameById(diamonds[1])..' contigo.', cid) talkState[talkUser] = 0 end end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Boa sorte. Volte e poste o resultado. Editado Agosto 27, 2014 10 anos por Adriano SwaTT (veja o histórico de edições) 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 Agosto 27, 2014 10 anos cara tenho esse é facin Vamos chama-lo de Max *--* em data/npc/Max.xml <?xml version="1.0" encoding="UTF-8"?> <npc name="Max" script="diamond.lua" walkinterval="350000" floorchange="0" speed="0" lookdir="2"> <health now="150" max="150"/> <look type="510" head="91" body="114" legs="86" feet="0"/> <parameters> <parameter key="message_greet" value="Bem vindo |PLAYERNAME| eu posso te ajudar diga {ajuda}."/> </parameters> </npc> agora em npc/script/diamond.lua 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 -- Conversa Jogador/NPC if(msgcontains(msg, 'tgyhdfyhfuyu') or msgcontains(msg, 'uigyuurtdrt')) then selfSay('hi', cid) elseif(msgcontains(msg, 'help') or msgcontains(msg, 'ajuda')) then selfSay('Eu troco 100 Diamonds por 100 Tds voce deseja?', cid) talkState[talkUser] = 1 -- Confirmação da Compra elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(doPlayerRemoveItem(cid, 2159, 100) == true) then selfSay('Thanks!', cid) doPlayerAddItem(cid, 2160, 100) talkState[talkUser] = 0 end end return TRUE end Editado Agosto 27, 2014 10 anos por MaxxSilva (veja o histórico de edições) Meus trabalhos °Pacote de shinys da 3ª e 4ª geração http://www.tibiaking.com/forum/topic/37128-patch-pokemons-shinys-3%C2%AA-e-alguns-da-4%C2%AA-gera%C3%A7%C3%A3o/ °Como criar novos pokemons no pda http://www.tibiaking.com/forum/topic/37546-tutorial-como-criar-novos-pokemons-para-seu-servidor/#entry212787 °Script de boost stone do otpokemonhttp://www.tibiaking.com/forum/topic/37849-action-script-de-boost-stone-parecido-com-otpokemon/ °Fly só para vipshttp://www.tibiaking.com/forum/topic/40868-poketibia-fly-para-vips/
Postado Agosto 27, 2014 10 anos Autor Abra o arquivo toddy.lua e cole este código dentro. 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 diamonds = {2159, 100} -- id, quantidade local moeda = {2160, 100} -- id, quantidade ------------------ MESSAGENS -------------------------- if (msgcontains(msg, 'trocar') or msgcontains(msg, 'trade')) then selfSay('Deseja trocar '..diamonds[2]..' '..getItemNameById(diamonds[1])..' por '..moeda[2]..' '..getItemNameById(moeda[1])..'?', cid) talkState[talkUser] = 3 ---------------------- NEGOCIAÇÃO --------------------------------------- elseif talkState[talkUser] == 3 then if (msgcontains(msg, 'sim') or msgcontains(msg, 'yes')) then if getPlayerItemCount(cid, diamonds[1]) >= diamonds[2] then doPlayerRemoveItem(cid, diamonds[1], diamonds[2]) doPlayerAddItem(cid, moeda[1], moeda[2]) selfSay('Obrigado, foi bom fazer negocio com voce', cid) else selfSay('Voce nao tem '..diamonds[2]..' '..getItemNameById(diamonds[1])..' contigo.', cid) talkState[talkUser] = 0 end end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Boa sorte. Volte e poste o resultado. Obrigado funcionou
Postado Agosto 27, 2014 10 anos Solução Por nada. Faça bom aproveito. Vou só pedir para selecionar como Melhor Resposta para que o tópico tenha a tag de Resolvido. Obrigado. Editado Agosto 27, 2014 10 anos por Adriano SwaTT (veja o histórico de edições) 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.