Rasinsk 2 Postado Outubro 28, 2012 Share Postado Outubro 28, 2012 Fui pessar um npc de poketibia para meu server de tfs 0.4 só que da erro no script onde diz: local npcpos = getThingPos(getThis()) O erro é o "getThis" (coloquei só uma local npcpos = getThingPos(getThis()) local focpos = getThingPos(focus) if npcpos.z ~= focpos.z then focus = 0 return true end if getDistanceToCreature(focus) > 3 then selfSay('Come back whenever you want to buy more coins!') focus = 0 return true end local dir = doDirectPos(npcpos, focpos) selfTurn(dir) end Se precisar do código inteiro deixo aqui: local focus = 0 local talk_start = 0 local price = 0 local conv = 0 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) local msg = string.lower(msg) if focus == cid then talk_start = os.clock() end if msgcontains(msg, 'bye') and focus == cid then selfSay('Have a nice gambling!') focus = 0 return true end if msgcontains(msg, 'no') and focus == cid and conv == 0 then selfSay('Ok then, feel free to come back whenever you want to.') focus = 0 return true end if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) <= 3 then selfSay("Hello! You are at the Celadon's Gamer Corner. To gamble here, you need cassino coins. Do you want to buy some?") focus = cid talk_start = os.clock() conv = 0 return true end if ((msgcontains(msg, 'yes') and conv == 0) or msgcontains(msg, 'coins')) and focus == cid and conv ~= 1 then selfSay('Tell me, how many coins do you wish to buy?') conv = 1 return true end if tonumber(msg) ~= nil and tonumber(msg) >= 1 and tonumber(msg) <= 500 and focus == cid then if getPlayerStorageValue(cid, 23254) >= 1000 then selfSay("It seems that you already have a lot of coins! You can't buy more coins if you already have more than 1000.") return true end if price / 10 == tonumber(msg) then return true end price = tonumber(msg) * 10 selfSay(""..msg.." coins are going to cost "..price.." dollars, can you afford it?") conv = 3 return true end if tonumber(msg) ~= nil and (tonumber(msg) < 1 or tonumber(msg) > 500) and focus == cid then selfSay("I can sell only sell amounts between 1 and 500 of coins at once!") conv = 2 return true end if msgcontains(msg, 'yes') and conv == 3 and focus == cid then if getPlayerStorageValue(cid, 23254) == -1 then setPlayerStorageValue(cid, 23254, 0) end if doPlayerRemoveMoney(cid, price * 100) then local amount = price / 10 setPlayerStorageValue(cid, 23254, getPlayerStorageValue(cid, 23254) + amount) selfSay("Here you are! You bought "..amount.." cassino coins, have a nice gambling!") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You bought "..amount.." cassino coins. Now you have a total of "..getPlayerStorageValue(cid, 23254).." cassino coins.") else selfSay("Sorry, buy you don't have enough money to pay for it!") end conv = 2 return true end if msgcontains(msg, 'no') and conv == 3 and focus == cid then selfSay("So, would you like to buy any coins?") conv = 0 return true end end local intervalmin = 38 local intervalmax = 70 local delay = 25 local number = 1 local messages = {"Come here to buy cassino coins! Check our prices!", "Looking for coins? You can buy them here!", "Check out our prices! Start gambling today!", "Did you know you can exchange coins for wonderful prizes?", } function onThink() if focus == 0 then selfTurn(1) delay = delay - 0.5 if delay <= 0 then selfSay(messages[number]) number = number + 1 if number > #messages then number = 1 end delay = math.random(intervalmin, intervalmax) end return true else if not isCreature(focus) then focus = 0 return true end local npcpos = getThingPos(getThis()) local focpos = getThingPos(focus) if npcpos.z ~= focpos.z then focus = 0 return true end if getDistanceToCreature(focus) > 3 then selfSay('Come back whenever you want to buy more coins!') focus = 0 return true end local dir = doDirectPos(npcpos, focpos) selfTurn(dir) end if os.clock() - talk_start > 59 then selfSay('We can talk later, when you are decided about what to buy.') focus = 0 end return true end To tentando coloca o sistema de cassino mas esse erro ta impedindo, alguém me ajuda pls, quem conseguir ganha REP+ Agradeço desde já. Link para o comentário https://xtibia.com/forum/topic/197596-encerrado-npc-cassino-erro-no-script/ Compartilhar em outros sites More sharing options...
LuckOake 400 Postado Outubro 28, 2012 Share Postado Outubro 28, 2012 (editado) Rapaz, ao menos existe essa função no seu server? Bem provável que o erro é porquê ela não existe. Aproveitando, essa não é a área pra pedir sistema de pokemon. Tópico movido. Editado Outubro 28, 2012 por LuckOake Link para o comentário https://xtibia.com/forum/topic/197596-encerrado-npc-cassino-erro-no-script/#findComment-1374256 Compartilhar em outros sites More sharing options...
Slicer 1070 Postado Outubro 28, 2012 Share Postado Outubro 28, 2012 nao sei qual a versao do teu serv mas.. tenta trocar o getThis() por isso.. getNpcCid() e recomendo fazer topico com duvidas/pedidos sobre pokemon na parte de servidores derivados.. ^^ Link para o comentário https://xtibia.com/forum/topic/197596-encerrado-npc-cassino-erro-no-script/#findComment-1374258 Compartilhar em outros sites More sharing options...
brun123 369 Postado Outubro 28, 2012 Share Postado Outubro 28, 2012 é que essa função é declarada na lib dos npcs: getNpcCid = getNpcId getThis = getNpcId são todas a mesma coisa Link para o comentário https://xtibia.com/forum/topic/197596-encerrado-npc-cassino-erro-no-script/#findComment-1374281 Compartilhar em outros sites More sharing options...
Rasinsk 2 Postado Outubro 29, 2012 Autor Share Postado Outubro 29, 2012 (editado) Vocês se confundiram kk' eu disse que retirei o npc de um serv de poketibia, agora, o meu serv é tfs 0.4 REP+ Slicer deu certo só q agora ficou outro erro --> doDirectPos Ganha REP+ agora quem concertar esse outro erro Editado Outubro 29, 2012 por Rasinsk Link para o comentário https://xtibia.com/forum/topic/197596-encerrado-npc-cassino-erro-no-script/#findComment-1375869 Compartilhar em outros sites More sharing options...
Slicer 1070 Postado Outubro 29, 2012 Share Postado Outubro 29, 2012 local dir = getDirectionTo(npcpos, focpos) Link para o comentário https://xtibia.com/forum/topic/197596-encerrado-npc-cassino-erro-no-script/#findComment-1375873 Compartilhar em outros sites More sharing options...
Rasinsk 2 Postado Outubro 29, 2012 Autor Share Postado Outubro 29, 2012 Deu certo agora e sem erros! Muito obrigado pela ajuda Slicer, amanhã te dou + 1 REP+ (o de hoje ja dei pra vc, achei q ja tinha usado mas ainda n kk) Link para o comentário https://xtibia.com/forum/topic/197596-encerrado-npc-cassino-erro-no-script/#findComment-1375940 Compartilhar em outros sites More sharing options...
Session Start 125 Postado Outubro 29, 2012 Share Postado Outubro 29, 2012 Duvida sanada, reportado para moverem Link para o comentário https://xtibia.com/forum/topic/197596-encerrado-npc-cassino-erro-no-script/#findComment-1375944 Compartilhar em outros sites More sharing options...
Prezyoso 44 Postado Outubro 29, 2012 Share Postado Outubro 29, 2012 Movido, Obrigado cleber... Você veem contribuindo muito reportando para mim Att, Prezyoso Link para o comentário https://xtibia.com/forum/topic/197596-encerrado-npc-cassino-erro-no-script/#findComment-1375947 Compartilhar em outros sites More sharing options...
Stigal 585 Postado Abril 20, 2018 Share Postado Abril 20, 2018 A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta. + Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda. * Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado. Link para o comentário https://xtibia.com/forum/topic/197596-encerrado-npc-cassino-erro-no-script/#findComment-1732469 Compartilhar em outros sites More sharing options...
Posts Recomendados