WExpert 15 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 Bom, eu queria u npc de quest, o q ele tem q faser ? pedir o item de um player e dar outro e se o player n tiver o item ele n dar o outro item. Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/ Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 Vá em data/npc, crie um arquivo chamado Changer.xml, e adicione isso dentro; <?xml version="1.0"?> <npc name="Quest Changer" script="data/npc/scripts/qstchanger.lua" access="3" lookdir="1" autowalk="200" speed="200"> <health now="1" max="1"/> <look type="120" head="38" body="79" legs="107" feet="114"/> </npc> Agora em data/npc/scripts, crie um arquivo chamado qstchanger.lua e adicione isso dentro: local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false local addon_state = 0 function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') 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 local item1 = 2133 -- ID DO ITEM QUE O PLAYER VAI RECEBER local item2 = 2134 -- ID DO ITEM QUE O PLAYER TEM Q DAR function onCreatureSay(cid, type, msg) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Olá, sou o NPC da Quest, tem o item necessário?') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') or msgcontains(msg, 'quest') then then if doPlayerRemoveItem(cid,item2,1) == TRUE then selfSay('Obrigado, aqui está sua recompensa!') doPlayerAddItem(cid,item1,1) addon_state = 0 else selfSay('Você não tem o item necessário!') talk_start = 0 end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..') focus = 0 talk_start = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 30 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 Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477083 Compartilhar em outros sites More sharing options...
0 WExpert 15 Postado Fevereiro 26, 2013 Autor Share Postado Fevereiro 26, 2013 (editado) kra,n funfou e o npc desaparece qundo ponho essa script, mais eu queria saber se da pra mi dar uma ajudinha aki numas libs -- quero faser uma lib de DoPlayerRemoveItem (cid,itemid,count) quero que ela cheque se o player tem o item, tem como faser isso ? Editado Fevereiro 26, 2013 por WExpert Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477100 Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 (editado) Essa função ai não vai checar se o player tem o item, vai remover! ACHEI O ERRO, TESTA AE ;] local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false local addon_state = 0 function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') 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 local item1 = 2133 -- ID DO ITEM QUE O PLAYER VAI RECEBER local item2 = 2134 -- ID DO ITEM QUE O PLAYER TEM Q DAR function onCreatureSay(cid, type, msg) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Olá, sou o NPC da Quest, tem o item necessário?') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') or msgcontains(msg, 'quest') then if doPlayerRemoveItem(cid,item2,1) == TRUE then selfSay('Obrigado, aqui está sua recompensa!') doPlayerAddItem(cid,item1,1) addon_state = 0 else selfSay('Você não tem o item necessário!') talk_start = 0 end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..') focus = 0 talk_start = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 30 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 Editado Fevereiro 26, 2013 por Roksas Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477113 Compartilhar em outros sites More sharing options...
0 WExpert 15 Postado Fevereiro 26, 2013 Autor Share Postado Fevereiro 26, 2013 Kra n vai dar pra testar agora mais assim q puder eu testo isso ae e se der serto ponho seu rep+ ate lá... Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477115 Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 Ok, quanto a sua dúvida de checar se o plaayer tem o item, tem essa function: getPlayerItemCount(cid, itemid) Ou seja, if getPlayerItemCount(cid, 2148) >= 99 then Se o player tiver 99 ou mais moedas, faça ) Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477117 Compartilhar em outros sites More sharing options...
0 WExpert 15 Postado Fevereiro 27, 2013 Autor Share Postado Fevereiro 27, 2013 (editado) tinha colocado 2 then so num canto xD , mais como faço pra o player so conseguir faser a quest 1 vez ? tipo mudar o storage o player pra so faser 1 ves. e olha aki esse meu script de npc, q ta dando errado, pq msm o kra tando sem o item ele da a recompença: local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') 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') then selfSay('Hey I am very hungry, Can you give me 30 dragon tails?.') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') then if getPlayerStorageValue(cid,6000) == 1 then selfSay('Sorry You Cant Do this quest.') elseif msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid,2672,30) == 0 then selfSay('Sorry Dont have that items.') else if doPlayerAddItem(cid,2264,1) then setPlayerStorageValue(cid,6000,1) selfSay('Thanks take this') focus = 0 talk_start = 0 end end end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '!') focus = 0 talk_start = 0 end end end function onThink() doNpcSetCreatureFocus(focus) 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 se puder mi ajudar nesse npc acima ajudaria mais doq ajeitando akele seu npc, pq fiz muitos desse jeito ae e tao com o msms erro. Editado Fevereiro 27, 2013 por WExpert Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477648 Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 27, 2013 Share Postado Fevereiro 27, 2013 (editado) Pera, deixa eu entenderr. Você quer que arrume o NPC acima, e use de base para o outro. Ou oque? Eu arrumei uns erros que achei nesse de cima, concertei a storage e tals: local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') 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') then selfSay('Hey I am very hungry, Can you give me 30 dragon tails?.') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') then if getPlayerStorageValue(cid,6000) ~= 1 then selfSay('Sorry You Cant Do this quest.') elseif msgcontains(msg, 'yes') and doPlayerRemoveItem(cid,2672,30) == FALSE then selfSay('Sorry Dont have that items.') else if doPlayerAddItem(cid,2264,1) then setPlayerStorageValue(cid,6000,1) selfSay('Thanks take this') focus = 0 talk_start = 0 end end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '!') focus = 0 talk_start = 0 end end end function onThink() doNpcSetCreatureFocus(focus) 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 EDIT -- AQUELE PRIMEIRÃO, COLOQUEI PRA FAZER SÓ 1X Q NEM VC PEDIU local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false local addon_state = 0 function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') 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 local item1 = 2133 -- ID DO ITEM QUE O PLAYER VAI RECEBER local item2 = 2134 -- ID DO ITEM QUE O PLAYER TEM Q DAR function onCreatureSay(cid, type, msg) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Olá, sou o NPC da Quest, tem o item necessário?') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') or msgcontains(msg, 'quest') then if getPlayerStorageValue(cid,3211) ~= 1 then if doPlayerRemoveItem(cid,item2,1) == TRUE then selfSay('Obrigado, aqui está sua recompensa!') doPlayerAddItem(cid,item1,1) setPlayerStorageValue(cid,3211,1) addon_state = 0 else selfSay('Você não tem o item necessário!') talk_start = 0 end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..') focus = 0 talk_start = 0 end end end end function onCreatureChangeOutfit(creature) end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 30 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 Editado Fevereiro 27, 2013 por Roksas Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477651 Compartilhar em outros sites More sharing options...
0 WExpert 15 Postado Fevereiro 27, 2013 Autor Share Postado Fevereiro 27, 2013 eu quero q vc so ajeite akele q te mandei , e testei ele e n deu serto, ele fika falando q vc ja fez a quest sendo q vc n fez(obs a storage tava serta, mais so n tava pedindo o item tipo vc podia n ter o item msm assim ele dava o premio. (testei o npc q te mandei e vc consertou e deu esse bug no storage, so precisa ajeitar pra ele so dar o premio se tiver o item da quest) Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477661 Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 27, 2013 Share Postado Fevereiro 27, 2013 Aqui, tirei a storage e mudei uma coisa. Acho que vai funcionar: local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false local addon_state = 0 function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') 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 local item1 = 2133 -- ID DO ITEM QUE O PLAYER VAI RECEBER local item2 = 2134 -- ID DO ITEM QUE O PLAYER TEM Q DAR function onCreatureSay(cid, type, msg) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Olá, sou o NPC da Quest, tem o item necessário?') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') or msgcontains(msg, 'quest') then if doPlayerRemoveItem(cid,item1,1) == TRUE then selfSay('Obrigado, aqui está sua recompensa!') doPlayerAddItem(cid,item2,1) addon_state = 0 else selfSay('Você não tem o item necessário!') talk_start = 0 end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..') focus = 0 talk_start = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 30 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 Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477664 Compartilhar em outros sites More sharing options...
0 WExpert 15 Postado Fevereiro 27, 2013 Autor Share Postado Fevereiro 27, 2013 funfou, mais o player fika fasendo a quest quantas veses quiser, tem como vc ajeitar dnv ? ei, perae, o seu q vc mandou com a storage tava dando serto, oq deu errado foi o q mandei pra vc ajeitar e vc mi mandou com a storage errada tendeu ? ele n ta pedindo o item como eu disse, tenta ajeitar ele ae local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') 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') then selfSay('Hey I am very hungry, Can you give me 30 dragon tails?.') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') then if getPlayerStorageValue(cid,6000) == 1 then selfSay('Sorry You Cant Do this quest.') elseif msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid,2672,30) == 0 then selfSay('Sorry Dont have that items.') else if doPlayerAddItem(cid,2264,1) then setPlayerStorageValue(cid,6000,1) selfSay('Thanks take this') focus = 0 talk_start = 0 end end end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '!') focus = 0 talk_start = 0 end end end function onThink() doNpcSetCreatureFocus(focus) 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 Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477670 Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 27, 2013 Share Postado Fevereiro 27, 2013 Prontinho, boa sorte com o sv ;] local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false local addon_state = 0 function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') 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 local item1 = 2133 -- ID DO ITEM QUE O PLAYER VAI RECEBER local item2 = 2134 -- ID DO ITEM QUE O PLAYER TEM Q DAR function onCreatureSay(cid, type, msg) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Olá, sou o NPC da Quest, tem o item necessário?') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') or msgcontains(msg, 'quest') then if doPlayerRemoveItem(cid,item1,1) == TRUE and getPlayerStorageValue(cid,12139) ~= 1 then selfSay('Obrigado, aqui está sua recompensa!') doPlayerAddItem(cid,item2,1) setPlayerStorageValue(cid,12139,1) addon_state = 0 else selfSay('Você não tem o item necessário!') talk_start = 0 end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..') focus = 0 talk_start = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 30 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 Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477671 Compartilhar em outros sites More sharing options...
0 WExpert 15 Postado Fevereiro 27, 2013 Autor Share Postado Fevereiro 27, 2013 (editado) esse ae eh akele meu? esse q mandei agora ? tenta descobrir onde ta o erro desse q te agradeço (como eu disse o player n tem o item e ele da a recompensa) local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') 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') then selfSay('Hey I am very hungry, Can you give me 30 dragon tails?.') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') then if getPlayerStorageValue(cid,6000) == 1 then selfSay('Sorry You Cant Do this quest.') elseif msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid,2672,30) == 0 then selfSay('Sorry Dont have that items.') else if doPlayerAddItem(cid,2264,1) then setPlayerStorageValue(cid,6000,1) selfSay('Thanks take this') focus = 0 talk_start = 0 end end end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '!') focus = 0 talk_start = 0 end end end function onThink() doNpcSetCreatureFocus(focus) 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 Editado Fevereiro 27, 2013 por WExpert Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477673 Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 27, 2013 Share Postado Fevereiro 27, 2013 Vejamos: local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') 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') then selfSay('Hey I am very hungry, Can you give me 30 dragon tails?.') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') and getPlayerStorageValue(cid,6001) == 1 then selfSay('Sorry You Cant Do this quest.') elseif msgcontains(msg, 'yes') and doPlayerRemoveItem(cid,2672,30) == FALSE then selfSay('Sorry Dont have that items.') elseif getPlayerStorageValue(cid,6001) >= 2 then elseif doPlayerAddItem(cid,2264,1) then setPlayerStorageValue(cid,6000,1) selfSay('Thanks take this') focus = 0 talk_start = 0 elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '!') focus = 0 talk_start = 0 end end end function onThink() doNpcSetCreatureFocus(focus) 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 Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477674 Compartilhar em outros sites More sharing options...
0 WExpert 15 Postado Fevereiro 27, 2013 Autor Share Postado Fevereiro 27, 2013 kra, o bug todo tava em por FALSE then la no removeitem xD, mais vc mi ajudou pra karamba intao ae vai o rep+ e t+ Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477680 Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 27, 2013 Share Postado Fevereiro 27, 2013 Funcionou? ) Boa sorte. Dúvida sanada, reported. Link para o comentário https://xtibia.com/forum/topic/208625-npc-de-quest/#findComment-1477682 Compartilhar em outros sites More sharing options...
Pergunta
WExpert 15
Bom, eu queria u npc de quest, o q ele tem q faser ? pedir o item de um player e dar outro e se o player n tiver o item ele n dar o outro item.
Link para o comentário
https://xtibia.com/forum/topic/208625-npc-de-quest/Compartilhar em outros sites
17 respostass a esta questão
Posts Recomendados