colex 8 Postado Agosto 1, 2006 Share Postado Agosto 1, 2006 Olá, Este code que eu vou liberar agora, facilitar a qualquer um (até quem não sabe mexer com NPC) a fazer um npc de entertrenimento que faz perguntas. Primeiro mostrarei o NPC que eu fiz com perguntas sobre o XTibia: ------NPC QUIZ BY COLEX------ focus = 0 talk_start = 0 target = 0 following = false attacking = false q = 1 w = 0 certas = 0 erradas = 0 question = {} question[1] = {p="Quem é o atual administrador do xtibia sem ser o Gustavo?", r="don"} question[2] = {p="Quem é o coordenador registrado em julho de 2005?", r="caidera"} question[3] = {p="Como se chama o mascote do XTibia?", r="x-boy"} question[4] = {p="Quem foi o primeiro colaborador de Actions do XTibia", r="colex"} question[5] = {p="Quem foi o vencedor do 1º XTibia Scripting Championship?", r="xxxhiagoxxx"} question[6] = {p="A regra número 3 da seção geral na parte OTServer fala sobre...", r="flood"} question[7] = {p="Qual o nome da rádio oficial do XTibia?", r="jovemix"} question[8] = {p="Qual o nome da 1ª equipe a ter seu lugar no Incentivos XTibia?", r="spol team"} question[9] = {p="Qual o username do antigo moderador atual apoio, cujo sua primeira letra é igual a primeira letra do nome do site?", r="x9kill"} question[10] = {p="Quem é o co-fundador da Spol Team?", r="bizugo"} question[11] = {p="Quem deu a idéia para o projecto X-OTS?", r="jvchequer"} question[12] = {p="Quem postou o code para NPCs venderem Bps de items?", r="frerety"} function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') selfLook(cid) focus = 0 talk_start = 0 end end function onCreatureTurn(creature) end function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) msg = string.lower(msg) if ((msgcontains(msg, 'hi')) and (focus == 0)) and getDistanceToCreature(cid) < 6 then selfSay('Olá, Eu sou um NPC de entertrenimento feito por Colex, para eu começar as perguntas digite: continuar.') focus = cid talk_start = os.clock() end if msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 6 then selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.') endif (focus == cid) and getDistanceToCreature(cid) < 6 then if (w == 1) then if msgcontains(msg, question[q].r) then selfSay('Certa resposta, diz Continuar para passar-mos a próxima pergunta!') talk_start = os.clock() q = q+1 certas = certas + 1 w = 0 else selfSay('Resposta errada, diz Continuar para passar-mos a próxima pergunta!') talk_start = os.clock() q = q+1 w = 0 erradas = erradas + 1 end else if msgcontains(msg, 'continuar') then if question[q] then selfSay(question[q].p) talk_start = os.clock() w = 1 else selfSay('Esta foi a última pergunta, voce teve ' .. certas .. ' respostas certas e ' .. erradas .. ' respostas erradas.') focus = 0 talk_start = 0 q = 1 w = 0 certas = 0 erradas = 0 end end end if msgcontains(msg, 'bye') or msgcontains(msg, 'xau') then selfSay('Adeus, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 q = 1 w = 0 certas = 0 erradas = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() if (os.clock() - talk_start) > 120 then if focus > 0 then selfSay('Próxima...') q = 1 w = 0 certas = 0 erradas = 0 end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Adeus então.') q = 1 w = 0 certas = 0 erradas = 0 end end end ------------------------------------------------------------------ Tutorial - Fazendo seu NPC de perguntas facilmente Este é um code de NPC Quiz virgem (sem perguntas) feito por mim: ------NPC QUIZ BY COLEX------ focus = 0 talk_start = 0 target = 0 following = false attacking = false q = 1 w = 0 certas = 0 erradas = 0 question = {} function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') selfLook(cid) focus = 0 talk_start = 0 end end function onCreatureTurn(creature) end function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) msg = string.lower(msg) if ((msgcontains(msg, 'hi')) and (focus == 0)) and getDistanceToCreature(cid) < 6 then selfSay('Olá, Eu sou um NPC de entertrenimento feito por Colex, para eu começar as perguntas digite: continuar.') focus = cid talk_start = os.clock() end if msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 6 then selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.') endif (focus == cid) and getDistanceToCreature(cid) < 6 then if (w == 1) then if msgcontains(msg, question[q].r) then selfSay('Certa resposta, diz Continuar para passar-mos a próxima pergunta!') talk_start = os.clock() q = q+1 certas = certas + 1 w = 0 else selfSay('Resposta errada, diz Continuar para passar-mos a próxima pergunta!') talk_start = os.clock() q = q+1 w = 0 erradas = erradas + 1 end else if msgcontains(msg, 'continuar') then if question[q] then selfSay(question[q].p) talk_start = os.clock() w = 1 else selfSay('Esta foi a última pergunta, voce teve ' .. certas .. ' respostas certas e ' .. erradas .. ' respostas erradas.') focus = 0 talk_start = 0 q = 1 w = 0 certas = 0 erradas = 0 end end end if msgcontains(msg, 'bye') or msgcontains(msg, 'xau') then selfSay('Adeus, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 q = 1 w = 0 certas = 0 erradas = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() if (os.clock() - talk_start) > 120 then if focus > 0 then selfSay('Próxima...') q = 1 w = 0 certas = 0 erradas = 0 end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Adeus então.') q = 1 w = 0 certas = 0 erradas = 0 end end end para voce adicionar perguntas é mais facil que comer pão. a seguir ao: question = {} voce vai adicionando o seguinte: question[Nº DA PERGUNTA] = {p="PERGUNTA", r="RESPOSTA"} é só isso, podia ser mais facil? com esse code que eu fiz, voce só terá que escrever aquilo que o script faz o resto e voce pode adicionar quantas perguntas quiser. um exemplo de uma pergunta adicionada, neste exemplo a pergunta é a pergunta numero 5: question[5] = {p="Quem fez este code?", r="colex"} O code foi projetado para facilitar a criação desse tipo de NPC até a quem tem experiencia 0 com NPC's Espero que aproveitem bem! Alguma dúvida? sinta-se livre para perguntar! 100% by Colex Atenciosamente, Colex Link para o comentário Compartilhar em outros sites More sharing options...
Eigenlieb 9 Postado Agosto 1, 2006 Share Postado Agosto 1, 2006 Muito bom! Parabéns! Excelente CODE :-) Abraços Link para o comentário Compartilhar em outros sites More sharing options...
Angel Of Ilusions 0 Postado Agosto 1, 2006 Share Postado Agosto 1, 2006 aew cara.. ótimo code...ótimo npc xD resolveu solta as idéia pa vê se vira alguma coisa vão faze agora server com Silvio Santos fazendo perguntas e respostas ruim que as perguntas serão sempre as mesmas xP vlws flws ae fuiz!! Link para o comentário Compartilhar em outros sites More sharing options...
Empty Flask 0 Postado Outubro 4, 2006 Share Postado Outubro 4, 2006 Tem maneira de colocar o npc a fazer as perguntas aleatoriamente, e quando falhar a 3 respostas acabar de fazer perguntas Link para o comentário Compartilhar em outros sites More sharing options...
afk 2 Postado Outubro 4, 2006 Share Postado Outubro 4, 2006 ótimo tutorial ^^ thx Link para o comentário Compartilhar em outros sites More sharing options...
tibiaa4e 86 Postado Novembro 17, 2006 Share Postado Novembro 17, 2006 mto roooooxxxxxx keria fazer npcs de perguntas estilo rl tibia + pregunta se eu ksier add um item com actionid uma key é o msm script q nas actions ??? Link para o comentário Compartilhar em outros sites More sharing options...
Rocksody 0 Postado Novembro 19, 2006 Share Postado Novembro 19, 2006 OM*G, colex rulez plz otimo tutor cara, 11de10 se puder colocar random as perguntas vai ser 20de10 abco aizen Link para o comentário Compartilhar em outros sites More sharing options...
Kenzo 0 Postado Dezembro 2, 2006 Share Postado Dezembro 2, 2006 Muito bom cara, mas... Se eu quiser fazer assim. O player vai la responde tudo certo e ganha um premio como eu fasso? playeradditem? //Kenzo Link para o comentário Compartilhar em outros sites More sharing options...
Thyranic 0 Postado Dezembro 3, 2006 Share Postado Dezembro 3, 2006 Omg! Realmente ótimo! Muito bom... Mais minha dúvida é a mesma do Kenzo! Como faço para adicionar uma recompensa para um player que acertar somente todas as questões? Obrigado Yours thy. Link para o comentário Compartilhar em outros sites More sharing options...
Hyuuga Cyrex~ 0 Postado Dezembro 7, 2006 Share Postado Dezembro 7, 2006 Ta facinho de entende, parabens Colex Link para o comentário Compartilhar em outros sites More sharing options...
skynagerloas 1 Postado Maio 25, 2007 Share Postado Maio 25, 2007 Tópico contendo somente 1 NpC, essa seção é para DataPacks com 3 ou mais Npcs, ~o{Tópico Movido}o~, Abraços. Link para o comentário Compartilhar em outros sites More sharing options...
Conde Sapo 4 Postado Dezembro 26, 2007 Share Postado Dezembro 26, 2007 question[1] = {p="Quem é o usuário mais charmoso do XTibia?", r="Conde Sapo"}question[2] = {p="Quem é o mais idoso do XTibia?", r="Conde Sapo"} question[3] = {p="Como se chama o usuário ranzinza do XTibia?", r="Conde Sapo"} question[4] = {p="Quem foi o primeiro colaborador idoso do XTibia", r="Conde Sapo"} question[5] = {p="Quem foi o vencedor do concurso de CUSPE A DISTANCIA do bairro?", r="Conde Sapo"} question[6] = {p="Quem é o usuário número 59616?", r="Conde Sapo"} question[7] = {p="Qual o nome do colaborador mais sensual do XTibia?", r="Conde Sapo"} question[8] = {p="Qual o nome do usuário que sempre faz trabalhos 'Exclusivo para XTibia' ?", r="Conde Sapo"} question[9] = {p="Qual o username do colaborador que enche o saco corrigindo erros de português?", r="Conde Sapo"} question[10] = {p="Quem é o pai da TopSkill 'Cliany' (Sword e Shield) ?", r="Conde Sapo"} question[11] = {p="Quem é o babaca que tá alterando meu NPC?", r="Conde Sapo"} question[12] = {p="Quem tá sem idéias para novas perguntas?", r="Conde Sapo"} Ótimo NPC parabundas :hi: Link para o comentário Compartilhar em outros sites More sharing options...
Powerzin 20 Postado Dezembro 28, 2007 Share Postado Dezembro 28, 2007 Muito Bom Otimo Npc Abraços. Link para o comentário Compartilhar em outros sites More sharing options...
MaNeRiNhU 0 Postado Janeiro 3, 2008 Share Postado Janeiro 3, 2008 ow poderia colocar tipo uma unique id q se a pessoa erra n pode + jogar e tals... ? e pra colocar item eh soh add a funçao doplayeradditem alguma coisa assim flws Link para o comentário Compartilhar em outros sites More sharing options...
zimbituba 17 Postado Maio 12, 2008 Share Postado Maio 12, 2008 como sempre Colex detonando com os npc excelente brother aprovadissimo um bom npc Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados