Jump to content
dragontechi

ayuda con lua temp bag

Recommended Posts

ayuda con este npc quiero hacer que la cloack llegue con su nivel de reginado y gemas a temp bag
 

--[[
-----------------------------------------------------------------------------------------------
- Transferir ítem al Temp Bag mediante el slot escogido
- Desarrollado por Techi para PKODev
-----------------------------------------------------------------------------------------------
--]]

-- Definir la tabla de ítems permitidos con sus nombres
local allowed_items = {
    {id = 6912, name = "[Bracelet]", description = "Bracelet description"},
    {id = 6913, name = "[Handguard]", description = "Handguard description"},
    {id = 6914, name = "[Belt]", description = "Belt description"},
    {id = 9205, name = "[Belt]", description = "Belt description"},
    -- Agregar más ítems según sea necesario
}

-- Función para enviar ítems al bolso temporal
-- Función para enviar ítems al bolso temporal
function SendItemsToTempBag(ignore, role, freq, time)
    local targetSlot = 47 -- Número de slot objetivo

    for _, item_info in ipairs(allowed_items) do
        local item_id = item_info.id
        local item_name = item_info.name

        -- Obtener el ítem en el slot
        local item_in_slot = GetChaItem(role, 2, targetSlot)
        local slot_item_id = GetItemID(item_in_slot)

        if slot_item_id == item_id then
            -- Obtener el nivel del ítem actual
            local item_level = GetItemAttr(item_in_slot, 55)
            
            -- Enviar el ítem al bolso temporal con el mismo nivel
            GiveItemX(role, 0, item_id, 1, 4, item_level)
            
            -- Eliminar el ítem del inventario
            TakeItem(role, 2, item_id, 1)
            
            -- Mostrar mensaje de envío
            BickerNotice(role, item_name .. " enviado al Temp Bag (Nivel " .. item_level .. ")")
            return 1
        end
    end
end


-- Agregar hook
Hook:AddPostHook("cha_timer", SendItemsToTempBag)

esta leyendo el nivel actual de la capa en el envio llega nivel 0

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...