markindoot 46 Postado Dezembro 9, 2013 Share Postado Dezembro 9, 2013 (editado) Falae galera do Xtibia, eu consegui aquele bug maldito do NPC antigo que tanto pedi a vocês =D o NPC é o seguinte, um player que ganha vocation do npc e é teletransportado. OBS: o char só pode aprender uma nova vocation no level 8+, se ele for level menor de 8, o NPC transporta ele para o town 1 Player:hi NPC:ola, você quer se tornar um Guerreiro, Arqueiro ou Mago? Player: Guerreiro NPC:Você deseja ser um glorioso guerreiro? Player: sim NPC: você acabou de se tornar um glorioso e honrado Guerreiro, eu irei lhe mover para Hermes City, OK? Player: ok. as ids das vocations é: Mago = 1 Arqueiro = 3 Guerreiro = 4. Editado Dezembro 9, 2013 por markindoot Link para o comentário Compartilhar em outros sites More sharing options...
0 ScythePhantom 83 Postado Dezembro 14, 2013 Share Postado Dezembro 14, 2013 Olha o double post brother... isso não é permitido aqui. Tente esses 1, 2, 3, 4 ou 5. Link para o comentário Compartilhar em outros sites More sharing options...
0 markindoot 46 Postado Dezembro 14, 2013 Autor Share Postado Dezembro 14, 2013 (editado) esse NPC, eu implantei ele no servidor e falo hi e ele diz isso: 20:07 The Oracle: Welcome, Fury Warrior! I have been expecting you.como eu ativo a converça com ele?tipo ele só fala isso, se eu falar sorcerer, druid, knight e paladin n da em nada. o script do NPC é esse: focus = 0 talk_start = 0target = 0following = falseattacking = falsetalk_state = 0cname = ''vocation = 0mainlevel = 8function onThingMove(creature, thing, oldpos, oldstackpos)endfunction onCreatureAppear(creature)endfunction onCreatureDisappear(cid, pos)if focus == cid thenselfSay('Tchau.')focus = 0talk_start = 0endendfunction onCreatureTurn(creature)endfunction msgcontains(txt, str)return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))endfunction onCreatureSay(cid, type, msg)cname = creatureGetName(cid)msg = string.lower(msg)if ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 thenselfSay('Ola ' .. cname .. '! Voce esta preparado para encarar o seu destino?')talk_state = 0focus = cidtalk_start = os.clock()elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 thenselfSay('Sorry, ' .. cname .. '! I talk to you in a minute.')elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 thenselfSay('Tchau, ' .. cname .. '!')talk_state = 0focus = 0talk_start = 0 elseif focus == cid thentalk_start = os.clock() if talk_state == 0 thenif msgcontains(msg, 'sim') then -- confirmando decisaolevel = getPlayerLevel(cname)if level >= mainlevel thenselfSay('Otimo! O que voce quer ser? Um knight, um paladin, um sorcerer ou um druid?')talk_state = 1elseselfSay('Lamento, voce precisa de level ' .. mainlevel .. ' para ir para mainland.')talk_state = 0endelseselfSay('Entao volte quando estiver preparado.')talk_state = 0endelseif talk_state == 1 then -- telling vocationtalk_state = 2if msgcontains(msg, 'sorcerer') thenselfSay('Um mistico sorcerer! Tem certeza?')vocation = 1elseif msgcontains(msg, 'druid') thenselfSay('Um misterioso druid! Tem certeza?')vocation = 2elseif msgcontains(msg, 'paladin') thenselfSay('Um certeiro paladin! Tem certeza?')vocation = 3elseif msgcontains(msg, 'knight') thenselfSay('Um incrivel knight! Tem certeza?')vocation = 4elseselfSay('Sorry, there is no such vocation.')vocation = 0talk_state = 1endelseif talk_state == 2 then -- confirmando vocif msgcontains(msg, 'sim') thenselfSay('Otimo! Posso te mandar pra City. Para onde voce quer ir?')talk_state = 3elseselfSay('Que vocacao voce quer entao?')talk_state = 1endelseif talk_state == 3 then -- telling city nameif msgcontains(msg, 'city') thenselfSay('Boa sorte, jovem aventureiro!')setPlayerVocation(cid,vocation)setPlayerMasterPos(cid,160,54,7)selfSay('/send ' .. cname .. ', 160 54 7')talk_state = 0focus = 0talk_start = 0elseselfSay('Desculpe, nao existe essa cidade.')talk_state = 3endendendendfunction onCreatureChangeOutfit(creature)endfunction onThink()if (os.clock() - talk_start) > 45 thenif focus > 0 thenselfSay('Next Please...')endfocus = 0endif focus ~= 0 thenif getDistanceToCreature(focus) > 5 thenselfSay('Good bye then.')focus = 0endendend[spoiler/] Editado Dezembro 14, 2013 por markindoot Link para o comentário Compartilhar em outros sites More sharing options...
0 ScythePhantom 83 Postado Dezembro 14, 2013 Share Postado Dezembro 14, 2013 (editado) esse NPC, eu implantei ele no servidor e falo hi e ele diz isso: 20:07 The Oracle: Welcome, Fury Warrior! I have been expecting you. como eu ativo a converça com ele? tipo ele só fala isso, se eu falar sorcerer, druid, knight e paladin n da em nada. o script do NPC é esse: focus = 0 talk_start = 0 target = 0 following = false attacking = false talk_state = 0 cname = '' vocation = 0 mainlevel = 8 function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Tchau.') 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) cname = creatureGetName(cid) msg = string.lower(msg) if ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Ola ' .. cname .. '! Voce esta preparado para encarar o seu destino?') talk_state = 0 focus = cid talk_start = os.clock() elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. cname .. '! I talk to you in a minute.') elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then selfSay('Tchau, ' .. cname .. '!') talk_state = 0 focus = 0 talk_start = 0 elseif focus == cid then talk_start = os.clock() if talk_state == 0 then if msgcontains(msg, 'sim') then -- confirmando decisao level = getPlayerLevel(cname) if level >= mainlevel then selfSay('Otimo! O que voce quer ser? Um knight, um paladin, um sorcerer ou um druid?') talk_state = 1 else selfSay('Lamento, voce precisa de level ' .. mainlevel .. ' para ir para mainland.') talk_state = 0 end else selfSay('Entao volte quando estiver preparado.') talk_state = 0 end elseif talk_state == 1 then -- telling vocation talk_state = 2 if msgcontains(msg, 'sorcerer') then selfSay('Um mistico sorcerer! Tem certeza?') vocation = 1 elseif msgcontains(msg, 'druid') then selfSay('Um misterioso druid! Tem certeza?') vocation = 2 elseif msgcontains(msg, 'paladin') then selfSay('Um certeiro paladin! Tem certeza?') vocation = 3 elseif msgcontains(msg, 'knight') then selfSay('Um incrivel knight! Tem certeza?') vocation = 4 else selfSay('Sorry, there is no such vocation.') vocation = 0 talk_state = 1 end elseif talk_state == 2 then -- confirmando voc if msgcontains(msg, 'sim') then selfSay('Otimo! Posso te mandar pra City. Para onde voce quer ir?') talk_state = 3 else selfSay('Que vocacao voce quer entao?') talk_state = 1 end elseif talk_state == 3 then -- telling city name if msgcontains(msg, 'city') then selfSay('Boa sorte, jovem aventureiro!') setPlayerVocation(cid,vocation) setPlayerMasterPos(cid,160,54,7) selfSay('/send ' .. cname .. ', 160 54 7') talk_state = 0 focus = 0 talk_start = 0 else selfSay('Desculpe, nao existe essa cidade.') talk_state = 3 end end end end function onCreatureChangeOutfit(creature) end function onThink() if (os.clock() - talk_start) > 45 then if focus > 0 then selfSay('Next Please...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Good bye then.') focus = 0 end end end[spoiler/] Qual "xml" você utilizou para colocá-lo no seu server? Poderia me mostrar? Editado Dezembro 14, 2013 por ScythePhantom Link para o comentário Compartilhar em outros sites More sharing options...
0 markindoot 46 Postado Dezembro 14, 2013 Autor Share Postado Dezembro 14, 2013 <?xml version="1.0"?> <npc name="The Oracle" script="data/npc/scripts/oraclenv.lua" access="1" monster="1" speed="50" lookdir="2" pushable="0" level="100"> <health now="150" max="150"/> <look type="2010" head="57" body="59" legs="40" feet="76"/> </npc> tava junto ao NPC Link para o comentário Compartilhar em outros sites More sharing options...
0 ScythePhantom 83 Postado Dezembro 15, 2013 Share Postado Dezembro 15, 2013 <?xml version="1.0"?> <npc name="The Oracle" script="data/npc/scripts/oraclenv.lua" access="1" monster="1" speed="50" lookdir="2" pushable="0" level="100"> <health now="150" max="150"/> <look type="2010" head="57" body="59" legs="40" feet="76"/> </npc> tava junto ao NPC Hum... tente assim: <?xml version="1.0" encoding="UTF-8"?> <npc name="The Oracle" script="data/npc/scripts/NOMEDAPASTA.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="332" head="21" body="87" legs="107" feet="95" addons="0"/> <parameters> <parameter key="message_greet" value="Hello, I can set their vocation |PLAYERNAME|."/> <parameter key="message_farewell" value="Good bye, |PLAYERNAME|."/> <parameter key="message_walkaway" value="Good bye, |PLAYERNAME|." /> </parameters> </npc> Link para o comentário Compartilhar em outros sites More sharing options...
0 markindoot 46 Postado Dezembro 17, 2013 Autor Share Postado Dezembro 17, 2013 <?xml version="1.0"?> <npc name="The Oracle" script="data/npc/scripts/oraclenv.lua" access="1" monster="1" speed="50" lookdir="2" pushable="0" level="100"> <health now="150" max="150"/> <look type="2010" head="57" body="59" legs="40" feet="76"/> </npc> tava junto ao NPC Hum... tente assim: <?xml version="1.0" encoding="UTF-8"?> <npc name="The Oracle" script="data/npc/scripts/NOMEDAPASTA.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="332" head="21" body="87" legs="107" feet="95" addons="0"/> <parameters> <parameter key="message_greet" value="Hello, I can set their vocation |PLAYERNAME|."/> <parameter key="message_farewell" value="Good bye, |PLAYERNAME|."/> <parameter key="message_walkaway" value="Good bye, |PLAYERNAME|." /> </parameters> </npc> eu falo com o NPC e ele nem me responde LoL Link para o comentário Compartilhar em outros sites More sharing options...
0 ScythePhantom 83 Postado Dezembro 17, 2013 Share Postado Dezembro 17, 2013 Brother você está colocando o diretório do npc? Link para o comentário Compartilhar em outros sites More sharing options...
0 markindoot 46 Postado Dezembro 17, 2013 Autor Share Postado Dezembro 17, 2013 RESOLVIDO, pode fechar o tópico! REP+ por tentar ajudar Scythe achei outro NPC a meu gosto. Link para o comentário Compartilhar em outros sites More sharing options...
0 ScythePhantom 83 Postado Dezembro 17, 2013 Share Postado Dezembro 17, 2013 Que bom, fico feliz. Reportado para que movam. Link para o comentário Compartilhar em outros sites More sharing options...
0 Omega 377 Postado Dezembro 17, 2013 Share Postado Dezembro 17, 2013 Tópico movido para a seção de dúvidas e pedidos resolvidos. Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
markindoot 46
Falae galera do Xtibia, eu consegui aquele bug maldito do NPC antigo que tanto pedi a vocês =D
o NPC é o seguinte, um player que ganha vocation do npc e é teletransportado.
OBS: o char só pode aprender uma nova vocation no level 8+, se ele for level menor de 8, o NPC transporta ele para o town 1
Player:hi
NPC:ola, você quer se tornar um Guerreiro, Arqueiro ou Mago?
Player: Guerreiro
NPC:Você deseja ser um glorioso guerreiro?
Player: sim
NPC: você acabou de se tornar um glorioso e honrado Guerreiro, eu irei lhe mover para Hermes City, OK?
Player: ok.
as ids das vocations é:
Mago = 1
Arqueiro = 3
Guerreiro = 4.
Editado por markindootLink para o comentário
Compartilhar em outros sites
10 respostass a esta questão
Posts Recomendados