Postado Junho 8, 2022 2 anos .Qual servidor ou website você utiliza como base? TFS 1.3 Qual o motivo deste tópico? Modificar script Está surgindo algum erro? Se sim coloque-o aqui. Citar Quero incluir uma função que em vez de remover a pedra ela se transforme em pequenas pedradrinhas id: 12706 e depois de um tempo ela se transforme novamente na pedra id: 12705 com a actionid= 40041 Você tem o código disponível? Se tiver publique-o aqui: local rewards = { { item = 8298, count = 1, chance = 50 }, { item = 8299, count = 1, chance = 50 }, { item = 8301, count = 1, chance = 50 }, { item = 8302, count = 1, chance = 50 }, { item = 8303, count = 1, chance = 50 }, { item = 8310, count = 1, chance = 50 }, { item = 9971, count = 1, chance = 50 }, { item = 5944, count = 1, chance = 100 } } local storage = 5000 local delay_timer = 5 function onUse(player, item, fromPosition, target, toPosition, isHotkey) local cur_time, cur_storage = os.time(), player:getStorageValue(storage) if cur_storage > cur_time then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can mining again in " .. os.date("!%Hh %Mm %Ss", cur_storage - cur_time) .. ".") return true end local function addbackstone() local stones = {12705} local stone = Game.createItem(stones[math.random(#stones)], 1, toPosition) stone:setActionId(40041) end if not target then return false end if not target:isItem() then return false end if target.actionid ~= 40041 then local pos = player:getPosition() player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You cannot use it here.') return false end if target.actionid == 40041 then local ran = math.random(100) if ran <= 10 then toPosition:sendMagicEffect(3) target:remove() addEvent(addbackstone, 120000) return true end end local text = "You have found " for i = 1, #rewards do local rand = math.random(1000) if rand <= rewards[i].chance then player:addItem(rewards[i].item, rewards[i].count) if text ~= "You have found " then text = text .. ", " end text = text .. rewards[i].count .. " " .. ItemType(rewards[i].item):getName() end end if text == "You have found " then text = text .. "nothing" end player:sendTextMessage(36, text .. ".") cur_time = cur_time + delay_timer player:setStorageValue(storage, cur_time) return true end Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. @Toruk Se tiver tempo para me ajudar
Postado Junho 8, 2022 2 anos Da uma testada ai. Eu acho q vai funcionar assim. local rewards = { { item = 8298, count = 1, chance = 50 }, { item = 8299, count = 1, chance = 50 }, { item = 8301, count = 1, chance = 50 }, { item = 8302, count = 1, chance = 50 }, { item = 8303, count = 1, chance = 50 }, { item = 8310, count = 1, chance = 50 }, { item = 9971, count = 1, chance = 50 }, { item = 5944, count = 1, chance = 100 } } local storage = 5000 local delay_timer = 5 function onUse(player, item, fromPosition, target, toPosition, isHotkey) local cur_time, cur_storage = os.time(), player:getStorageValue(storage) if cur_storage > cur_time then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can mining again in " .. os.date("!%Hh %Mm %Ss", cur_storage - cur_time) .. ".") return true end local function addBackStone() local tRocks = getTileItemById(toPosition, 12706) if tRocks then doRemoveItem(tRocks.uid, 1) local stones = {12705} local stone = Game.createItem(stones[math.random(#stones)], 1, toPosition) stone:setActionId(40041) end end if not target then return false end if not target:isItem() then return false end if target.actionid ~= 40041 then local pos = player:getPosition() player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You cannot use it here.') return false end if target.actionid == 40041 then local ran = math.random(100) if ran <= 10 then toPosition:sendMagicEffect(3) target:transform(12706) addEvent(addBackStone, 120000) return true end end local text = "You have found " for i = 1, #rewards do local rand = math.random(1000) if rand <= rewards[i].chance then player:addItem(rewards[i].item, rewards[i].count) if text ~= "You have found " then text = text .. ", " end text = text .. rewards[i].count .. " " .. ItemType(rewards[i].item):getName() end end if text == "You have found " then text = text .. "nothing" end player:sendTextMessage(36, text .. ".") cur_time = cur_time + delay_timer player:setStorageValue(storage, cur_time) return true end
Postado Junho 8, 2022 2 anos Autor 6 horas atrás, Toruk disse: Da uma testada ai. Eu acho q vai funcionar assim. local rewards = { { item = 8298, count = 1, chance = 50 }, { item = 8299, count = 1, chance = 50 }, { item = 8301, count = 1, chance = 50 }, { item = 8302, count = 1, chance = 50 }, { item = 8303, count = 1, chance = 50 }, { item = 8310, count = 1, chance = 50 }, { item = 9971, count = 1, chance = 50 }, { item = 5944, count = 1, chance = 100 } } local storage = 5000 local delay_timer = 5 function onUse(player, item, fromPosition, target, toPosition, isHotkey) local cur_time, cur_storage = os.time(), player:getStorageValue(storage) if cur_storage > cur_time then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can mining again in " .. os.date("!%Hh %Mm %Ss", cur_storage - cur_time) .. ".") return true end local function addBackStone() local tRocks = getTileItemById(toPosition, 12706) if tRocks then doRemoveItem(tRocks.uid, 1) local stones = {12705} local stone = Game.createItem(stones[math.random(#stones)], 1, toPosition) stone:setActionId(40041) end end if not target then return false end if not target:isItem() then return false end if target.actionid ~= 40041 then local pos = player:getPosition() player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You cannot use it here.') return false end if target.actionid == 40041 then local ran = math.random(100) if ran <= 10 then toPosition:sendMagicEffect(3) target:transform(12706) addEvent(addBackStone, 120000) return true end end local text = "You have found " for i = 1, #rewards do local rand = math.random(1000) if rand <= rewards[i].chance then player:addItem(rewards[i].item, rewards[i].count) if text ~= "You have found " then text = text .. ", " end text = text .. rewards[i].count .. " " .. ItemType(rewards[i].item):getName() end end if text == "You have found " then text = text .. "nothing" end player:sendTextMessage(36, text .. ".") cur_time = cur_time + delay_timer player:setStorageValue(storage, cur_time) return true end Mano na moral tu é foda, não sabe como quebrei a cabeça para tentar resolver isso kkk, só ficou um detalhe que não está tirando o actionID
Postado Junho 8, 2022 2 anos N sei se eu entnendi, mas ele n ta setando o AID? Se for isso, tente por um if no createItem da stone, na função addBackStone(): Se n for isso, tente explicar melhor oque ta ocorrendo, pq eu n to com nenhum sv baixado pra testar local function addBackStone() local tRocks = getTileItemById(toPosition, 12706) if tRocks then doRemoveItem(tRocks.uid, 1) local stones = {12705} local stone = Game.createItem(stones[math.random(#stones)], 1, toPosition) if stone then stone:setActionId(40041) end end end
Postado Junho 8, 2022 2 anos Autor 6 minutos atrás, Toruk disse: N sei se eu entnendi, mas ele n ta setando o AID? Se for isso, tente por um if no createItem da stone, na função addBackStone(): Se n for isso, tente explicar melhor oque ta ocorrendo, pq eu n to com nenhum sv baixado pra testar local function addBackStone() local tRocks = getTileItemById(toPosition, 12706) if tRocks then doRemoveItem(tRocks.uid, 1) local stones = {12705} local stone = Game.createItem(stones[math.random(#stones)], 1, toPosition) if stone then stone:setActionId(40041) end end end Quando a pedra se transforma nas pedrinhas ela continua com a mesmo ActionID, ou seja ainda é possivel continuar minerando e a ideia seria evitar a mineração em quanto não volta a pedra. Olha o ActionID é o mesmo
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.