Postado Junho 7, 2019 6 anos .Qual servidor ou website você utiliza como base? Znote AAC Qual o motivo deste tópico? Estou criando um sistema diferente para usar a pá. Neste sistema ao usar a pá em um determinado ground, ele troca um groundid por outro, um buraco. O id do buraco precisa voltar a ser o original depois de um certo tempo. Então fiz a seguinte linha de código dentro de uma condifção: Citar local randomValue = math.random(1, 100) if randomValue < 15 then -- item 1 (15%) Game.createItem(2152, 1, toPosition) ground:transform(8323) ground:decay(231) id do ground original: 231 id do ground do buraco: 8323 Tudo funciona perfeitamente dentro do código. Inclusive dentro do game, ao dar Look no ground do buraco aparece o seguinte: "You see a hole. Item ID: 8323 Decays to: 231" Mas o ground nunca volta ao normal. Então tentei adicionar o DECAY diretamente ao id do ground através do arquivo data/items/items.xml pra ver se funcionava. Citar <item id="8323" article="a" name="hole" /> <-- ID do ground (buraco) <item id="8313" article="a" name="birch" /> <item id="8314" article="a" name="dead tree" /> <item fromid="8315" toid="8322" name="sand" /> <item fromid="8324" toid="8325" article="a" name="heap of sand" /> <item fromid="8326" toid="8334" name="dried grass" /> <item fromid="8335" toid="8346" name="sand" /> <item fromid="8347" toid="8348" name="dried grass" /> <item fromid="8349" toid="8360" name="dry grass" /> <item id="8361" name="jagged stones" /> <item fromid="8362" toid="8364" name="earth" /> <item id="8365" name="rifty earth" /> <item fromid="8366" toid="8367" name="earth" /> <item id="8368" name="cheese"> <attribute key="weight" value="400" /> <attribute key="showcount" value="0" /> <attribute key="decayTo" value="231" /> <-- DECAY para o ID 231 <attribute key="duration" value="2" /> </item> Então mudei no script da pá o ground:decay(231) para ground:decay() Mas acontece a mesma coisa. No jogo aparece: "You see a hole. Item ID: 8323 Decays to: 231" Mas nunca muda o id de 8323 de volt para 231 Alguém tem uma ideia de como resolver isso? Está surgindo algum erro? Se sim coloque-o aqui. Nenhum erro no distro do TFS 1.3 que estou usando. Você tem o código disponível? Se tiver publique-o aqui: Meu Action script para a Shovel é o seguinte: (Coloquei anotação na parte referente ao que comentei) *Abaixo o script completo Citar elseif table.contains(sand, groundId) then < ------------------------------------------INICIA A CONDIÇÃO PARA CAVAR O GROUND 231 local randomValue = math.random(1, 100) < --------------------------------------- espaço amostral if randomValue < 15 then -- item 1 (15%) < ----------------------------------------chance de cavar o item Game.createItem(2152, 1, toPosition) < ------------------------------------------- mudar o Item que ganha ao cavar ground:transform(8323) < --------------------------------------------------- transforma o groundID 231 para 8323 ground:decay() < -------------------------------------------------------------------puxa o Decay registrado no items.xml Citar local holes = {468, 481, 483} -- buracos aparentes para abrir com a pá ( para a shovel padrao do tibia) local dirt = {352, 353, 354, 103} -- adicionar ids de tiles do tipo dirt local sand = {231} -- adicionar ids de tiles do tipo dirt local tab = { pos1 = {x = 33200, y = 31579, z = 8}, -- buraco scarabs pos2 = {x = 33202, y = 31591, z = 9}, -- buraco ancient scarabs --pos3 = {x = 0, y = 0, z = 0}, --pos4 = {x = 0, y = 0, z = 0}, --pos5 = {x = 0, y =0, z = 0}, --pos6 = {x = 0, y = 0, z = 0}, --pos7 = {x = 0, y = 0, z = 0}, } function onUse(player, item, fromPosition, target, toPosition, isHotkey) local tile = Tile(toPosition) local posx = target:getPosition() -- posição do target if not tile then return false end local ground = tile:getGround() if not ground then return false end local groundId = ground:getId() if table.contains(holes, groundId) then ground:transform(groundId + 1) ground:decay() toPosition.z = toPosition.z + 1 tile:relocateTo(toPosition) elseif table.contains(sand, groundId) then < ------------------------------------------INICIA A CONDIÇÃO PARA CAVAR O GROUND 231 local randomValue = math.random(1, 100) < --------------------------------------- espaço amostral if randomValue < 15 then -- item 1 (15%) < ----------------------------------------chance de cavar o item Game.createItem(2152, 1, toPosition) < ------------------------------------------- mudar o Item que ganha ao cavar ground:transform(8323) < --------------------------------------------------- transforma o groundID 231 para 8323 ground:decay() < -------------------------------------------------------------------puxa o Decay registrado no items.xml elseif randomValue > 15 and randomValue < 20 then -- item 2 (5%) Game.createItem(2160, 1, toPosition) ground:transform(8323) ground:decay() player:sendTextMessage(MESSAGE_EXPERIENCE, "You have found something.") elseif randomValue > 50 and randomValue < 95 then ground:transform(8323) ground:decay() elseif randomValue > 95 then Game.createMonster("Scarab", toPosition) ground:transform(8323) ground:decay() end toPosition:sendMagicEffect(CONST_ME_POFF) elseif groundId == 351 then -- id do tile a ser cavado! (unico) local randomValue = math.random(1, 100) if randomValue < 15 then Game.createItem(2159, 1, toPosition) ground:transform(355) ground:decay() player:sendTextMessage(MESSAGE_EXPERIENCE, "You have found something.") elseif randomValue > 95 then Game.createMonster("zombie", toPosition) ground:transform(355) ground:decay() player:sendTextMessage(MESSAGE_EXPERIENCE, "You woke up a zombie!") end toPosition:sendMagicEffect(CONST_ME_POFF) ground:transform(355) ground:decay() elseif table.contains(dirt, groundId) then -- id do tile a ser cavado! (sistema de tabela) local randomValue = math.random(1, 100) if randomValue < 15 then Game.createItem(2159, 1, toPosition) ground:transform(355) ground:decay() elseif randomValue > 95 then Game.createMonster("zombie", toPosition) ground:transform(355) ground:decay() end toPosition:sendMagicEffect(CONST_ME_POFF) ground:transform(355) ground:decay() -- elseif target:getPosition() == Position(tab.pos2) then -- cava buraco que da pra descer (buraco especifico). pos2 -- ground:transform(392) -- ground:decay() -- player:sendTextMessage(MESSAGE_EXPERIENCE, "pananananm!") else return false end if target:getPosition() == Position(tab.pos1) then ground:transform(392) ground:decay() player:sendTextMessage(MESSAGE_EXPERIENCE, "pananananm!") elseif target:getPosition() == Position(tab.pos2) then ground:transform(392) ground:decay() player:sendTextMessage(MESSAGE_EXPERIENCE, "pananananm!") else return false end return true end Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. Esse buraco nunca volta ao normal Editado Junho 7, 2019 6 anos por Havokz (veja o histórico de edições)
Postado Junho 8, 2019 6 anos Autor Problema resolvido! Foi apenas um erro de sintaxe na hora de escrever os atributos no arquivo items.xml coloquei certinho e funcionou ? Editado Junho 8, 2019 6 anos por Havokz (veja o histórico de edições)
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.