WExpert 15 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 Bom, eu ligo o server de boa, ae quando falo hi pro npc ele n fala nada e no log do theforgottenserver aparece isso [Error - Npc Interface] data/npc/sripts/test.lua:39: attempt to compare boolean with number stack traceback: data/npc/scripts/test.lua:39: in function <data/npc/scripts/test.lua:36> Obs: O q tem na linha 36 do script do npc é "function onCreatureSay(cid, type, msg)" <--sem aspas E na 39: if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 and getPlayerPz(cid) <= 0 then Quem ajudar leva meu reP+ Link para o comentário Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 Cara, posta o script completo por favor ) Usando spoilers pf. Link para o comentário Compartilhar em outros sites More sharing options...
0 SkyDarkyes 104 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 Duvida como eu fasso alguma coisa dentro de spoiler? Link para o comentário Compartilhar em outros sites More sharing options...
0 WExpert 15 Postado Fevereiro 26, 2013 Autor Share Postado Fevereiro 26, 2013 (editado) 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('Ahahha.') 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 and getPlayerPz(cid) <= 0 then selfSay('Hahaha ' .. getCreatureName(cid) .. '! Can you death me? Ueeeee ueee') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! hahahaha.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') then if getPlayerStorageValue(cid,8000) >= 1 then selfSay('Sorry You Cant Do this saga.') else travel(cid, 132, 610, 7) selfSay('You death!') focus = 0 talk_start = 0 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 26, 2013 por WExpert Link para o comentário Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 (editado) Sky, creio que isso seja flood. Mandasse PM ou criasse um tópico ) Bom, faça assim: COLOQUE SEU CODIGO AKI [/spoiler.] ja era ), essas 2 tags no começo e no fim do código (SEM O PONTO NO FINAL @@TOPICO BOM, TENTE ASSIM: 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('Ahahha.') 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)) then if getDistanceToCreature(cid) < 4 then if getPlayerPz(cid) <= 0 then selfSay('Hahaha ' .. getCreatureName(cid) .. '! Can you death me? Ueeeee ueee') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! hahahaha.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') then if getPlayerStorageValue(cid,8000) >= 1 then selfSay('Sorry You Cant Do this saga.') else travel(cid, 132, 610, 7) selfSay('You death!') focus = 0 talk_start = 0 end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. getCreatureName(cid) .. '!') focus = 0 talk_start = 0 end end 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 26, 2013 por Roksas Link para o comentário Compartilhar em outros sites More sharing options...
0 SkyDarkyes 104 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 (editado) Rep+ REP+ Editado Fevereiro 26, 2013 por SkyDarkyes Link para o comentário Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 cara é só no final no começo é sem o / ;] Funcionou o script? Link para o comentário Compartilhar em outros sites More sharing options...
0 WExpert 15 Postado Fevereiro 26, 2013 Autor Share Postado Fevereiro 26, 2013 (editado) n funfou, eu tenho um script parecido aki e funfa olha 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('Hey!.') 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('Do you want to finish Gt Saga??') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! ????????.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') then if getPlayerStorageValue(cid,8000) <= 53 then selfSay('Sorry You Cant Do this saga.') elseif msgcontains(msg, 'yes') then if getPlayerStorageValue(cid,8000) >= 55 then selfSay('Sorry You Cant Do this saga.') else if doPlayerAddItem(cid,5894,1) then setPlayerStorageValue(cid,8000,55) selfSay('Congratulations!') 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 interessante q copiei e colei na script do outro e continuou com akele erro, mais na dele msm n tem erro nenhum, vc fala hi e ele fala you finish gt saga? '-' Editado Fevereiro 26, 2013 por WExpert Link para o comentário Compartilhar em outros sites More sharing options...
0 Slicer 1070 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 sabes oq essa funçao faz? getPlayerPz(cid) o resto da linha 39 parece esta correto, eu soh n sei oq essa funçao retorna entao pode ser ela q ta dando o erro.. sei la kk Link para o comentário Compartilhar em outros sites More sharing options...
0 WExpert 15 Postado Fevereiro 26, 2013 Autor Share Postado Fevereiro 26, 2013 eu tentei tirar essa funçao ae e continua o erro Link para o comentário Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 (editado) Slicer, essa função coloquei assim: if getPlayerPz(cid) <= 0 then Ou seja 0 = NAO TA DENTRO PZ 1 = TA DENTRO PZ Não sei se ele tem essa function na lib dele ;s Experimente colocar isso no arquivo lib/050-function function getPlayerPz(cid) return (getTilePzInfo(getCreaturePosition(cid)) == TRUE) end Editado Fevereiro 26, 2013 por Roksas Link para o comentário Compartilhar em outros sites More sharing options...
0 SkyDarkyes 104 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 (editado) REP Editado Fevereiro 26, 2013 por SkyDarkyes Link para o comentário Compartilhar em outros sites More sharing options...
0 Slicer 1070 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 @rok se essa eh a funçao entao tu flo errado.. ela retorna true e false e n 0 e 1 e entao era esse o erro do script dele... Link para o comentário Compartilhar em outros sites More sharing options...
0 WExpert 15 Postado Fevereiro 26, 2013 Autor Share Postado Fevereiro 26, 2013 eu ja tinha colokado essa função aki, mais parece q ta errada msm pq testei sem ela e deu serto....e foi mal ae eu me confundi com as pastas dos servers ae tava falando errado malz, se tiver como ajeitar essa função mi ajudem pois preciso dela.. eu colokei == na função e funfou olha oq eu pensei.. ja q n existe numero a baixo de 0 na script eh por isso q ta dando erro pq ta assim <= intão colokei == mais so q o npc n quer transportar o player :s e eu acho q o 1 n ta dentro de pz neh n ? Link para o comentário Compartilhar em outros sites More sharing options...
0 Roksas 846 Postado Fevereiro 26, 2013 Share Postado Fevereiro 26, 2013 Cara, não tem muito objetivo essa função. Seria melhor tirar mesmo, ela só verifica se o player ta na área PZ. Link para o comentário Compartilhar em outros sites More sharing options...
0 WExpert 15 Postado Fevereiro 26, 2013 Autor Share Postado Fevereiro 26, 2013 mais vou te explicar pra q eh... isso eh um npc de saga, que modifica a storage do player, mais pra o player passar dessa "saga" ele precisa matar o monstro e dps ser teleportado e ganhar a storage pra ir pra proxima saga, se n tiver essa parada de playerpz o player n vai precisar matar o monstro e vai ser teleportado so em falar hi/yes , por isso precisa Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
WExpert 15
Bom, eu ligo o server de boa, ae quando falo hi pro npc ele n fala nada e no log do theforgottenserver aparece isso
[Error - Npc Interface]
data/npc/sripts/test.lua:39: attempt to compare boolean with number stack traceback:
data/npc/scripts/test.lua:39: in function <data/npc/scripts/test.lua:36>
Obs: O q tem na linha 36 do script do npc é "function onCreatureSay(cid, type, msg)" <--sem aspas
E na 39: if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 and getPlayerPz(cid) <= 0 then
Quem ajudar leva meu reP+
Link para o comentário
Compartilhar em outros sites
20 respostass a esta questão
Posts Recomendados