Ir para conteúdo
  • Cadastre-se

Suporte [Ajuda] Modificar script de mineração!


Ir para solução Resolvido por Toruk,

Posts Recomendados

.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

Link para o post
Compartilhar em outros sites

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

 

Link para o post
Compartilhar em outros sites

 

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

Link para o post
Compartilhar em outros sites

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

 

Link para o post
Compartilhar em outros sites
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

Pedras.gif

Link para o post
Compartilhar em outros sites
  • Solução

Entedi, só mudar o target:transform(12706), por:

target:remove()
Game.createItem(12706, 1, toPosition)

 

Script inteiro:

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)
			if stone then
				stone:setActionId(40041)
			end
		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:remove()
            Game.createItem(12706, 1, toPosition)
            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

 

Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por braianlomas
      Como faço para corrigir esse problema para meu cliente, eu uso o tfs 0.3.6  
      Quero resolver esse problema que tenho no meu cliente, como e onde posso resolver?  
      Eu uso o tfs 0.3.6, não tenho as fontes do cliente, se você puder me dar eu vou amá-las para sempre  
       

       
    • Por A.Mokk
      Ola pessoal, estou tentando compilar o TFS 1.5 Downgrade para 8.60 atraves do MSVC 2022, ao tentar compilar da o seguinte erro:
       
       
      Fiz o download do MSVC, GitDash, TFS-SDK-3.2, e de varios boosts que tentei, ao fazer o seguinte procedimento no GitDash:
       
      Ao chegar em ./bootstrap-vcpkg.bat o GitDash nao consegue realizar o procedimento corretamente, alguem poderia me ajudar ?

      Tentei de diversas formas mas o mesmo erro sempre persiste, atualmente meu servidor utiliza TFS 0.4, consigo compilar sem nenhum problema no MSVC 2010, porem, as limitações do TFS 0.4 estão me fazendo precisar atualizar, se alguem souber como corrigir esses erros eu agradeço !

      Tutoriais utilizados :
      Compiling on Windows (vcpkg) · otland/forgottenserver Wiki · GitHub
      Compiling on Windows · otland/forgottenserver Wiki · GitHub
      Compilando TFS 1.3 com vídeo-aula - Tutoriais Infraestrutura & Proteção - Tibia King - Tudo sobre Tibia, OTServ e Bots!
      Compilar TFS 1.3 Vcpkg - Tutoriais Infraestrutura & Proteção - Tibia King - Tudo sobre Tibia, OTServ e Bots!
       
      O que acontece no Powershell:
       
    • Por thunmin
      .Qual servidor ou website você utiliza como base? 
      Canary 2.3.6
      Qual o motivo deste tópico? 
      Queria fazer com que os players não pudessem mexer no aleta sio, pois, agora os mesmos estão conseguindo mexer nos itens
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
    • Por thunmin
      .Qual servidor ou website você utiliza como base? 
      canary para o cliente 13.16
      Qual o motivo deste tópico? 
      Não consigo encontrar onde ajusta
      to com o problema no 13.16  o exausted, por exemplo os kinas era pra combar exori, erori gran e exori min, porém não ta indo ta dando exausted o char ta soltando magia ou runa e não consegue usar as potions
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
    • Por Andersontatuador
      Olá galera da TK, me chamo Anderson estou procurando alguém profissional em otservs e site.
      Já tenho um servidor o site e o cliente preciso só de uma pessoal competente, que esteja empenhado a trabalhar,
      não quero nada de graça, pois nessa onda fui mais roubado do quer eu pagar um profissional.
      caso alguém se interesse entrar em contato comigo através do whatsapp
      82 9 9304-9462
       
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo