Postado Março 23, 2015 10 anos Eae Pessoal, Tudo Okay? Estou precisando de um npc que vende todas as bless! Aposto que algums vão fazer estes tipos de perguntas. Então vou logo responder "Você tem que procurar no fórum!" R: Eu procurei, achei alguns, mas todos ou não funcionava ou não estavam bem explicadas para alguem poder usar! "Então Fale Mais Como Você quer que funcione." R: é simples um npc de fácil configuração que venda todos os tipos de bless, cada bless que o npc vende ter uma configuração, se precisa de premium, level, promote, preço e coisas assim! O npc Vende todas as bless separadas e uma que são todas juntas! Pronto é isto! espero que me ajudem por favor,Se tiver outra dúvida manda ai, Grande abraço a todos e Obrigado por ler o tópico! Editado Março 23, 2015 10 anos por Zet0N0Murmurou (veja o histórico de edições) Pokémon Dust Evolution É aonde começa sua nova aventura!! Facebook Verifique Atualizações
Postado Março 23, 2015 10 anos npc blessings : local config = { -- [bless] = preços bless1 = {"The Spiritual Shielding", 100}, bless2 = {"The Embrace of Tibia", 200}, bless3 = {"The Fire of the Suns", 300}, bless4 = {"The Wisdom of Solitude", 400}, bless5 = {"The Spark of the Phoenix", 500}, } 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 if msgcontains(msg:lower(), config.bless1[1]) then selfSay("you are sure?", cid) talkState[talkUser] = 1 elseif msgcontains(msg:lower(), config.bless2[1]) then selfSay("you are sure?", cid) talkState[talkUser] = 2 elseif msgcontains(msg:lower(),config.bless3[1]) then selfSay("you are sure?", cid) talkState[talkUser] = 3 elseif msgcontains(msg:lower(),config.bless4[1]) then selfSay("you are sure?", cid) talkState[talkUser] = 4 elseif msgcontains(msg:lower(), config.bless5[1]) then selfSay("you are sure?", cid) talkState[talkUser] = 5 end if msgcontains(msg:lower(), "yes") then if talkState[talkUser] == 1 then if not getPlayerBlessing(cid, 1) then if doPlayerRemoveMoney(cid, config.bless1[2]) then doPlayerAddBlessing(cid, 1) selfSay("you received the bless spiritual shielding!!", cid) doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA) talkState[talkUser] = 0 else selfSay("you no have money.", cid) talkState[talkUser] = 0 end else selfSay("you have blessing spiritual shielding.", cid) talkState[talkUser] = 0 end elseif talkState[talkUser] == 2 then if not getPlayerBlessing(cid, 2) then if doPlayerRemoveMoney(cid, config.bless2[2]) then doPlayerAddBlessing(cid, 2) selfSay("you received the bless embrace of tibia!!", cid) doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA) talkState[talkUser] = 0 else selfSay("you no have money.", cid) talkState[talkUser] = 0 end else selfSay("you have blessing embrace of tibia.", cid) talkState[talkUser] = 0 end elseif talkState[talkUser] == 3 then if not getPlayerBlessing(cid, 3) then if doPlayerRemoveMoney(cid, config.bless3[2]) then doPlayerAddBlessing(cid, 3) selfSay("you received the bless fire of the suns!!", cid) doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA) talkState[talkUser] = 0 else selfSay("you no have money.", cid) talkState[talkUser] = 0 end else selfSay("you have blessing fire of the suns.", cid) talkState[talkUser] = 0 end elseif talkState[talkUser] == 4 then if not getPlayerBlessing(cid, 4) then if doPlayerRemoveMoney(cid, config.bless4[2]) then doPlayerAddBlessing(cid, 4) selfSay("you received the bless wisdom of solitude!!", cid) doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA) talkState[talkUser] = 0 else selfSay("you no have money.", cid) talkState[talkUser] = 0 end else selfSay("you have blessing wisdom of solitude!!.", cid) talkState[talkUser] = 0 end elseif talkState[talkUser] == 5 then if not getPlayerBlessing(cid, 5) then if doPlayerRemoveMoney(cid, config.bless5[1]) then doPlayerAddBlessing(cid, 5) selfSay("you received the bless spark of the phoenix!!", cid) doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA) talkState[talkUser] = 0 else selfSay("you no have money.", cid) talkState[talkUser] = 0 end else selfSay("you have blessing spark of the phoenix.", cid) talkState[talkUser] = 0 end end end if msgcontains(msg:lower(), "no") and talkState[talkUser] >= 1 then selfSay("Bye!!", cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) se não souber fazer o arquivo.xml só falar. abrçs Editado Março 23, 2015 10 anos por Summ (veja o histórico de edições)
Postado Março 23, 2015 10 anos @Summ Se você me permite, eu dei uma diminuida. No seu script possui um erro também: if not doPlayerRemoveMoney(cid, config.bless5[1]) Esqueceu do then e esse not está no lugar errado (vai enviar o else se o player estiver com dinheiro). local config = { -- [bless] = preços [1] = {"The Spiritual Shielding", 100}, [2] = {"The Embrace of Tibia", 200}, [3] = {"The Fire of the Suns", 300}, [4] = {"The Wisdom of Solitude", 400}, [5] = {"The Spark of the Phoenix", 500} } 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 for k, v in pairs(config) do if v[1]:lower():find(msg:lower()) then selfSay("You are sure?", cid) talkState[talkUser] = k end if msgcontains(msg:lower(), "yes") then if talkState[talkUser] == k then if not getPlayerBlessing(cid, k) then if doPlayerRemoveMoney(cid, v[2]) then doPlayerAddBlessing(cid, k) selfSay("You received the bless " .. v[1]:gsub("The ", "", 1) .. "!", cid) doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA) else selfSay("You no have money.", cid) end else selfSay("You have blessing " .. v[1] .. ".", cid) end talkState[talkUser] = 0 end end end if msgcontains(msg:lower(), "no") and talkState[talkUser] >= 1 then selfSay("Bye!!", cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Março 23, 2015 10 anos por fireelement (veja o histórico de edições)
Postado Março 23, 2015 10 anos @fireelement obrigado por ter percebido os erros, já arrumei sobre o uso do for _, _ inpairs() do , eu também faria assim, ocupa menos tempo e fica mais simples, só que a ultima vez que eu usei inpairs() no npc, aconteceu um erro muito escroto e eu tive que refazer todo código, não lembro qual era o erro, mas desde então não fiz mais o uso em npcs rsrsrs.
Postado Março 23, 2015 10 anos Autor Faz ai o arquivo xml pra min ai Pokémon Dust Evolution É aonde começa sua nova aventura!! Facebook Verifique Atualizações
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.