L2Tower Discord Let's keep the community alive with discord. Discussions about plugins and scripts L2Tower Discord

Thread Closed 
 
Thread Rating:
  • 8 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The script to enchant and + 2 stops working what is wrong?
Author Message
xamius55 Offline
Elpy
*

Posts: 2
Joined: Jul 2012
Reputation: 0
Version: 1.4.2.138
Post: #1
The script to enchant and + 2 stops working what is wrong?

The script to enchant and +2 stops working what is wrong?
Code:
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(2100)

while true do
    -- weapon = getItemByName("Icarus Spirit", maxenchant)
    -- enchant = getItemByName("Scroll: Enchant Weapon (S)", maxenchant)
    weapon = getItemByName("Angel Slayer", maxenchant)
    enchant = getItemByName("Scroll: Enchant Weapon (Grade S)", maxenchant)
    enchantB = getItemByName("Scroll: Enchant Weapon (Grade S)", 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(enchantB.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
(This post was last modified: 08-07-2012 15:27 PM by xamius55.)
08-07-2012 15:25 PM
Find all posts by this user
AdioZ Offline
VIP Member
***

Posts: 36
Joined: Mar 2012
Reputation: -11
Version: 1.4.1.118
Post: #2
RE: The script to enchant and + 2 stops working what is wrong?

Interlude?
08-07-2012 19:12 PM
Find all posts by this user
Thread Closed 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Need Help] Enchant Script nvnhathuy 1 5,279 03-03-2017 20:07 PM
Last Post: deivuzas1
  L2Tower isn't working on Lineage II Mafia Shico 0 2,487 02-28-2017 18:56 PM
Last Post: Shico
  L2 Dragon question about bot, working or not kaan22747 0 2,621 02-15-2017 21:10 PM
Last Post: kaan22747
  LF Interlude low/mid rate Server with working l2tower pwsriddick 1 3,069 04-22-2016 21:26 PM
Last Post: Higorkovic
  CP/Mana Stop Working Crnogorac 3 3,734 04-08-2016 10:36 AM
Last Post: TheQQmaster
  l2avellan bot not working can halp any1 ? d1mmka 0 1,890 10-25-2015 04:53 AM
Last Post: d1mmka
  Get skill enchant level raid1141 1 4,155 10-15-2015 14:57 PM
Last Post: raid1141
  New working version folder ministra 4 3,474 10-11-2015 19:11 PM
Last Post: kerberos464
  L2 stop working when press login laydown 0 1,974 08-19-2015 00:53 AM
Last Post: laydown
  Healer stops heling erce 2 3,478 07-12-2015 19:59 PM
Last Post: erce



User(s) browsing this thread: 1 Guest(s)