Postado Outubro 28, 2017 7 anos Em 28/10/2017 em 14:58, DiigooMix disse: uma dúvida, o que seriam esses números? Por que todos começam com 1? E eu que sei? A função doReborn tá aí provavelmente em algum arquivo na sua lib, é só você dar uma olhada no que significa. Não tem como eu adivinhar o que é, só olhando a função, mas se tava funcionando, isso pouco importa. Em 28/10/2017 em 14:58, DiigooMix disse: só mais um detalhe que eu esqueci de citar (me desculpe por esquecer). Teria como ao rebornar, remover as esferas da bp? Ok, segue com a modificação: Mostrar conteúdo oculto local esferas = {12750, 12751, 12752, 12753, 12754, 12755, 12756} local t = { [8] = {level = 300, reborn = {1,10,9}}, [1] = {level = 149, reborn = {1,25,24}}, [36] = {level = 300, reborn = {1,42,37}}, [49] = {level = 300, reborn = {1,50,50}} } function checkItemsNeeded(cid, items) local check = {} for i, v in pairs(items) do if getPlayerItemCount(cid, v) >= 1 then check[#check + 1] = 1 end end return #check == #items end 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('???') 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) < 4 then selfSay('Olá! Se voce está pronto, diga "reborn".') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Hey!.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'reborn') and getPlayerStorageValue(cid,30023) == 4 then selfSay('Desculpe, mas voce já é rebornado.') focus = 0 talk_start = 0 elseif msgcontains(msg, 'reborn') then selfSay('Realmente quer isto?') talk_state = 2 elseif msgcontains(msg, 'yes') and talk_state == 2 then local voc = t[getPlayerVocation(cid)] if voc then if getPlayerLevel(cid) == voc.level then if checkItemsNeeded(cid, esferas) then for i, v in pairs(esferas) do doPlayerRemoveItem(cid, v, 1) end doReborn(cid, unpack(voc.reborn)) talk_state = 0 else selfSay('Você não possui as esferas do dragão!') talk_state = 0 end else selfSay('Você não tem level '..voc.level..".") talk_state = 0 end else selfSay('Sua vocação não pode rebornar..') talk_state = 0 end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Adeus!') focus = 0 talk_start = 0 end end end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 45 then if focus > 0 then selfSay('Próximo por favor...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Adeus!') focus = 0 end end end Em 28/10/2017 em 14:58, DiigooMix disse: [EDITED] não está funcionando 100% man, fiz um char Goku pra testar, botei ele lvl 300 e ele está com todas as transformações até as reborn, mesmo sem rebornar (não estava assim). Veja se você não modificou algo além disso, o npc não tem nada a ver com essas novas transformações adicionadas. Em 28/10/2017 em 14:58, DiigooMix disse: E a parte das esferas acho que não está 100%. Pois tirei da bp 1 das 7 e ele não retornou a mensagem dizendo que precisa de todas as 7. Verifique os ids das esferas, se escreveu certinho vai funcionar. Em 28/10/2017 em 14:58, DiigooMix disse: 13:28 Reborn: Sua vocação não pode rebornar.. Está dizendo isso. Se falar isso é porque o id da vocação do player não existe na tabela. Confira se existe o [id da vocação] que você está utilizando. Verifique se aparece algum erro (o que não é pra acontecer) na distro. Contato: Email: dwarfer@sapo.pt Discord: Dwarfer#2715
Postado Outubro 28, 2017 7 anos Autor Em 28/10/2017 em 16:25, Dwarfer disse: E eu que sei? A função doReborn tá aí provavelmente em algum arquivo na sua lib, é só você dar uma olhada no que significa. Não tem como eu adivinhar o que é, só olhando a função, mas se tava funcionando, isso pouco importa. Ok, segue com a modificação: Mostrar conteúdo oculto Mostrar conteúdo oculto local esferas = {12750, 12751, 12752, 12753, 12754, 12755, 12756} local t = { [8] = {level = 300, reborn = {1,10,9}}, [1] = {level = 149, reborn = {1,25,24}}, [36] = {level = 300, reborn = {1,42,37}}, [49] = {level = 300, reborn = {1,50,50}} } function checkItemsNeeded(cid, items) local check = {} for i, v in pairs(items) do if getPlayerItemCount(cid, v) >= 1 then check[#check + 1] = 1 end end return #check == #items end 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('???') 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) < 4 then selfSay('Olá! Se voce está pronto, diga "reborn".') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Hey!.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'reborn') and getPlayerStorageValue(cid,30023) == 4 then selfSay('Desculpe, mas voce já é rebornado.') focus = 0 talk_start = 0 elseif msgcontains(msg, 'reborn') then selfSay('Realmente quer isto?') talk_state = 2 elseif msgcontains(msg, 'yes') and talk_state == 2 then local voc = t[getPlayerVocation(cid)] if voc then if getPlayerLevel(cid) == voc.level then if checkItemsNeeded(cid, esferas) then for i, v in pairs(esferas) do doPlayerRemoveItem(cid, v, 1) end doReborn(cid, unpack(voc.reborn)) talk_state = 0 else selfSay('Você não possui as esferas do dragão!') talk_state = 0 end else selfSay('Você não tem level '..voc.level..".") talk_state = 0 end else selfSay('Sua vocação não pode rebornar..') talk_state = 0 end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Adeus!') focus = 0 talk_start = 0 end end end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 45 then if focus > 0 then selfSay('Próximo por favor...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Adeus!') focus = 0 end end end Veja se você não modificou algo além disso, o npc não tem nada a ver com essas novas transformações adicionadas. Verifique os ids das esferas, se escreveu certinho vai funcionar. Se falar isso é porque o id da vocação do player não existe na tabela. Confira se existe o [id da vocação] que você está utilizando. Verifique se aparece algum erro (o que não é pra acontecer) na distro. não sei porque não estava dando certo, exclui o char e fiz outro Goku, funcionou 100%.. removeu as esferas e tudo certinho Muitíssimo obrigado!! +REP
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.