Lineage 2 Tower Forum

Full Version: Auto Enchant Armor problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i have some problems with enchanting Elegia Tunic {PvP} armor
i try a lot of auto enchant scripts but cannot make it work
i always get an error or out of item dialog
can some1 make a simple script for this item plz
i have in inventory lot of armors and lot of enchants
but somehow the script cannot start

i have this script :

function enchantResult()
return GetEnchantManager():getLastResult()
end

function getItemByName(name, maxenchant)
invList = GetInventory();
for item in invList.list do
if item.Name == name and item.Enchanted < maxenchant then
-- ShowToClient("ITEM", item.Name .. " (ID: " .. item.displayId .. ")");
return item
end
end
end

maxenchant = 10
GetEnchantManager():setDelay(3100)

while true do
-- weapon = getItemByName("Icarus Spirit", maxenchant)
-- enchant = getItemByName("Scroll: Enchant Weapon (S)", maxenchant)
weapon = getItemByName("Elegia Tunic {PvP}", maxenchant)
enchant = getItemByName("Scroll: Enchant Armor (S-Grade)", maxenchant)
if ( weapon == nil or enchant == nil ) then
ShowToClient("Enchant:", "Out of weapons of enchants")
break
end

if ( weapon.Enchanted > maxenchant ) then
ShowToClient("Enchant:", "Reached desired enchant")
break
end
if ( weapon.Enchanted < 3 ) then
GetEnchantManager():setEnchantId(enchant.objectId)
end;
if ( weapon.Enchanted >= 3 ) then
GetEnchantManager():setEnchantId(enchant.objectId)
end;
GetEnchantManager():setItemId(weapon.objectId)
GetEnchantManager():Enchant()
-- ShowToClient(">>>>", "Waiting for result...");
while ( enchantResult() == Enchant.ENCHANT_PENDING ) do
Sleep(200)
end
if ( enchantResult() == Enchant.ENCHANT_SUCCESS ) then
Sleep ( 100 ) -- sleep so item data is updated
weapon = GetInventory():FindById(weapon.objectId)
ShowToClient("Enchant", weapon.Name .. " is now +" .. weapon.Enchanted);
elseif ( enchantResult() == Enchant.ENCHANT_FAILURE ) then
ShowToClient("Enchant", weapon.Name .. " failed on " .. weapon.Enchanted .. " -> " .. weapon.Enchanted+1)
end
-- ShowToClient(">>>>", "Last result" .. tostring(enchantResult()));
end
Code:
while true do
-- weapon = getItemByName("Icarus Spirit", maxenchant)
-- enchant = getItemByName("Scroll: Enchant Weapon (S)", maxenchant)
weapon = getItemByName("Elegia Tunic {PvP}", maxenchant)
enchant = getItemByName("Scroll: Enchant Armor (S-Grade)", maxenchant)
if ( weapon == nil or enchant == nil ) then
ShowToClient("Enchant:", "Out of weapons of enchants")
break
end

I'm 90% sure that this is the part that is messed up, I'm no expert but it says Scroll: Enchant Weapon (S) when it should be and Armor Enchant, and it also says icarus Spirit. Also make sure that your server says (S) and not (S-Grade) or (S-grade).
Reference URL's