Ir para conteúdo

Featured Replies

Postado

nao sei se existe, caso sim... alguem poderia disponibilizar o script por favor. Ou se puder bolar um !
um script que troca 2..3...4...5 items (configuravel) por 1.
pode ser um script simples, mas que fosse por alavanca. O player botasse os items no recipiente (ou nao, pode ser dentro da bp tbm) e ao puxar essa alavanca ''os 3 items sumissem e daria o novo item que foi formado para o player)

TFS 0.4 - 8.6


 

 

juntar.png

Resolvido por Mateus Robeerto

Ir para solução
  • Respostas 10
  • Visualizações 646
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Mateus Robeerto
    Mateus Robeerto

    Boa tarde! Fiz um script melhor e bem simples. É possível entender o script, Segue o GIF para ver como ele funciona e foi testado no tfs 0.4, tudo certo. Divirta-se function onUse(cid, item, from

Posted Images

Postado
7 horas atrás, GM Vortex disse:

já tem aqui no fórum... apenas você pode pegar o script e adaptar para seu jeito. Já tem explicado tudo sobre como funciona etc...

 

Esse meio que serve, so n to conseguindo botar mais de 2 items q é o padrao, teria como me da essa força pra adicionar mais items porfavor !??

 

Citar

function onUse(cid, item, frompos, item2, topos)

    local playerLocation = getCreaturePosition(cid)

    local weaponData = {
        -- ID da arma | ID do item de encantamento | quantidade do item de encantamento (opcional) | ID do item que a arma será transformada.
        {weaponId = 7735, enchantmentId = 12575, transformId = 12279},
        {weaponId = 7735, enchantmentId = 12393, amountEnchantment = 10, transformId = 12279}
    }

    local positions = {
        weaponTable      = {x = 719, y = 332, z = 7}, -- Onde o jogador deverá colocar a arma.
        enchantmentTable = {x = 717, y = 332, z = 7},  -- Onde o jogador deverá colocar o item de encantamento.
    }

    function check()
        for _, data in pairs(weaponData) do
            local weapon = getTileItemById(positions.weaponTable, data.weaponId)
            local enchantment = getTileItemById(positions.enchantmentTable, data.enchantmentId)
    
            if weapon.itemid == data.weaponId and enchantment.itemid == data.enchantmentId then

                local amountEnchantment = enchantment.type and data.amountEnchantment or 1

                if doRemoveItem(enchantment.uid, amountEnchantment) then
                    doRemoveItem(weapon.uid, 1)
                    doPlayerAddItem(cid, data.transformId, 1)
                    doSendMagicEffect(playerLocation, 39)
                    return true
                end
            end
        end
    end

    if not check() then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sem itens necessarios para o encantamento.")
        doSendMagicEffect(playerLocation, CONST_ME_POFF)
    end

    return true
end

 

Postado
function onUse(cid, item, frompos, item2, topos)
    local playerLocation = getCreaturePosition(cid)

    local enchantments = {
        [2361] = {amount = 1, transformId = 2453},
        [2159] = {amount = 10, transformId = 2646},
        -- Adicione mais itens de encantamento aqui
        [OutroID] = {amount = QuantidadeNecessaria, transformId = IDTransformacao}
    }

    local weaponEnchantmentTable = {
        {
            weaponId = 7735,
            positions = {
                weaponTable = {x = 32352, y = 31912, z = 7},
                enchantmentTable = {x = 32354, y = 31912, z = 7}
            },
            enchantmentIds = {2361}
        },
        {
            weaponId = 6132,
            positions = {
                weaponTable = {x = 32356, y = 31912, z = 7},
                enchantmentTable = {x = 32358, y = 31912, z = 7}
            },
            enchantmentIds = {2159}
        }
        -- Adicione mais armas e suas respectivas posições aqui
        -- Exemplo: {weaponId = IDDaArma, positions = {posicaoDaArma, posicaoDoEncantamento}, enchantmentIds = {IDDoEncantamento1, IDDoEncantamento2, ...}}
    }

    local function hasItems(items)
        for itemID, enchantmentData in pairs(items) do
            local enchantment = getTileItemById(enchantmentData.positions.enchantmentTable, itemID)
            if not enchantment or enchantment.type < enchantmentData.amount then
                return false
            end
        end
        return true
    end

    local function enchantWeapon(enchantmentData)
        for _, data in pairs(enchantmentData) do
            local weapon = getTileItemById(data.positions.weaponTable, data.weaponId)
            if weapon then
                local enchantmentsNeeded = data.enchantmentIds
                if hasItems(enchantmentsNeeded) then
                    for _, enchantmentID in ipairs(enchantmentsNeeded) do
                        local enchantment = getTileItemById(data.positions.enchantmentTable, enchantmentID)
                        if enchantment then
                            local requiredAmount = enchantments[enchantmentID].amount
                            doRemoveItem(enchantment.uid, requiredAmount)
                        end
                    end
                    doRemoveItem(weapon.uid, 1)
                    doPlayerAddItem(cid, enchantments[enchantmentID].transformId, 1)
                    doSendMagicEffect(playerLocation, 39)
                    return true
                end
            end
        end
        return false
    end

    if not enchantWeapon(weaponEnchantmentTable) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sem itens necessários para o encantamento.")
        doSendMagicEffect(playerLocation, CONST_ME_POFF)
    end

    return true
end

 

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo