tuduras
Well-Known Member
- Joined
- Jun 4, 2017
- Messages
- 351
- Solutions
- 2
- Reaction score
- 59
Hello , how are U?
I have got imbu script :
and i got imbu on item but it doesn't renew. look at screen
I noticed on paladin works hp mp leech , on druid doesn't work.

how to solve it ? thanks and best regards
I have got imbu script :
LUA:
local ImbuingSystem = Action()
-- Requisitos para cada nivel de imbuimiento
local ImbuingNivel = {
[1] = {crystalCoins = 100, successRate = 100},
[2] = {crystalCoins = 200, successRate = 100},
[3] = {crystalCoins = 300, successRate = 100},
[4] = {crystalCoins = 400, successRate = 100},
[5] = {crystalCoins = 500, successRate = 100},
[6] = {crystalCoins = 600, successRate = 100},
[7] = {crystalCoins = 700, successRate = 100},
[8] = {crystalCoins = 800, successRate = 100},
[9] = {crystalCoins = 900, successRate = 100},
[10] = {crystalCoins = 1000, successRate = 100},
}
-- Definición de IDs para imbuimientos
local ImbuingIDs = {
[2178] = "weapon", -- Critical Chance
[7761] = "helmet", -- Life Leech
[7762] = "armor", -- Mana Leech
[7760] = "boots", -- Health/Mana Regen
[2174] = "backpack", -- Extra Capacity
[7759] = "shield", -- Damage Absorb
[2144] = "legs" -- Speed
}
-- Definición de IDs para tipos de ítems
local ItemCategories = {
weapon = {2400, 2453, 6528, 5803, 2431, 2444, 7366, 7958},
helmet = {2493, 3972, 11302},
armor = {8890, 8881, 8888, 2505, 12657},
boots = {2195, 12646},
backpack = {1987, 1988},
shield = {2533, 2534},
legs = {2466, 2467}
}
-- Determina el tipo de ítem basado en su ID
local function determineItemType(itemId)
for type, ids in pairs(ItemCategories) do
for _, id in ipairs(ids) do
if id == itemId then
return type
end
end
end
return "unknown"
end
-- Función para obtener el texto de bonus basado en el tipo de ítem y el nivel
local function getBonusText(itemType, tier)
local bonusText = ""
if itemType == "weapon" then
bonusText = string.format("Critical Chance: %d%%", tier)
elseif itemType == "helmet" then
bonusText = string.format("Life Leech: %d%%", tier * 10)
elseif itemType == "armor" then
bonusText = string.format("Mana Leech: %d%%", tier * 10)
elseif itemType == "boots" then
bonusText = string.format("Health/Mana Regen: %d", tier * 10)
elseif itemType == "backpack" then
bonusText = string.format("Extra Capacity: %d%%", tier * 2)
elseif itemType == "shield" then
bonusText = string.format("Damage Absorb: %d%%", tier * 10)
elseif itemType == "legs" then
bonusText = string.format("Speed: %d%%", tier * 2)
end
return bonusText
end
function ImbuingSystem.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local imbuingId = item:getId()
local targetItem = target
if not targetItem or not targetItem:isItem() then
return false
end
local currentDescription = targetItem:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION) or ""
local tierCheck = tonumber(currentDescription:match("Tier %((%d+)%)"))
local itemType = determineItemType(targetItem:getId())
-- Verifica si el ítem de imbuimiento es aplicable
if ImbuingIDs[imbuingId] == itemType then
local maxTier = 10
if tierCheck == nil or (tierCheck >= 0 and tierCheck < maxTier) then
local tier = (tierCheck or 0) + 1
local required = ImbuingNivel[tier]
if required then
local playerCrystalCoins = player:getItemCount(2160)
if playerCrystalCoins >= required.crystalCoins then
local successChance = required.successRate
if math.random(1, 100) <= successChance then
-- Sukces
player:removeItem(2160, required.crystalCoins)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The item has been imbued successfully to Tier (" .. tier .. ").")
player:getPosition():sendMagicEffect(CONST_ME_ENERGY_HIT)
local bonusText = getBonusText(itemType, tier)
local newDescription = ""
-- POPRAWKA AKTUALIZACJI OPISU
if currentDescription:lower():find("tier") then
-- Aktualizujemy numer Tieru
newDescription = currentDescription:gsub("Tier %((%d+)%)", "Tier (" .. tier .. ")")
-- Wyciągamy nazwę bonusu (np. "Life Leech") i aktualizujemy jego wartość
local bonusName = bonusText:match("^(.-):")
if bonusName then
-- Szuka wzoru "Nazwa Bonusu: wartość%" i zamienia na nowy bonusText
newDescription = newDescription:gsub(bonusName .. ": [%.%d]+%%?", bonusText)
end
else
-- Jeśli to pierwsze ulepszenie
newDescription = "Tier (" .. tier .. "). " .. bonusText
end
targetItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, newDescription)
player:removeItem(imbuingId, 1)
else
-- Porażka
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The imbuing failed. The item remains unchanged.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need " .. required.crystalCoins .. " Crystal Coins to perform this imbuing.")
end
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your item already has the maximum level of imbuement.")
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "This imbuing stone cannot be used on this type of item.")
end
return true
end
-- Rejestracja wszystkich ID kamieni
local stones = {2178, 3027, 3028, 3029, 7762, 7760, 7761, 2174, 7759, 2144}
for _, id in ipairs(stones) do
ImbuingSystem:id(id)
end
ImbuingSystem:register()
-- MoveEvent
local EquipEvent = MoveEvent()
function EquipEvent.onEquip(player, item, position, fromPosition)
if not player or player:isInGhostMode() then
return true
end
return true
end
EquipEvent:id(2178)
EquipEvent:register()
and i got imbu on item but it doesn't renew. look at screen

I noticed on paladin works hp mp leech , on druid doesn't work.

how to solve it ? thanks and best regards