XenoBot Forums - Powered by vBulletin

User Tag List

Results 1 to 1 of 1

Thread: [Paladin] Code to withdraw Enchanted Spears.

  1. #1
    zxzero's Avatar
    Join Date
    May 2013
    Location
    CANADA
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Paladin] Code to withdraw Enchanted Spears.

    @Nakuu if this is the wrong section, you can move it.

    I was having a bit of trouble with finding some help around the forum for this problem. I didn't ask or anything just tried searching for the code. This code is for withdrawing enchanted spears to use so I had to put it in myself. Big ups to @nixez for this code really, as that is where I got it from. I modified it a tiny bit as it was withdrawing then trying to withdraw again. I am not very good at coding and have only been using it for a short while, but no hitches so far. If anyone has anything better or can improve the code a bit feel free to post here. Hopefully the original creator doesn't mind me sharing this. As he is absent from the site I could not ask him.

    Sorry for the long paragraph. Without further ado the code is below. *Notice: If the script is in xblua, I don't know how to help you unless you want to ask the creator to add it in. Sorry.

    Place the following at the top of the script, before all the labels and such.

    Code:
    local AmmoID = 7367                   ---Id of Ammo To refill  <<Royal spear 7378>>>
    local MaxAmmo = 24                 --------How many ammo you wanna withdraw from depot                          
    local AmmoDP = 2	                   -- Slot of DP that will be for your ammunition.  0 is first depot box 1 is second depot box 2 is third depot box ETC
    Then, you will have to add a label named Spearwithdraw (or you can change the label name in the code), preferable right after the deposit label so you don't have to run back to the depot. Then enter the code below in the .lua file that you are running.


    Code:
    elseif(label == "Spearwithdraw") then
    		Container.GetByName("Locker"):OpenChildren({3502, true})            -- Opens depot chest
            wait(500,600)
        Container.GetByName("Locker"):Close()                               -- Closes locker
            wait(500,600)
            Self.WithdrawItems(AmmoDP, {AmmoID, 0, MaxAmmo-Self.ItemCount(AmmoID)}) -- 3 means from third backpack in DP, Ammo is ammunition ID, 0 means to first backpack you hold, last "number" is an amount to withdraw.
    In the end it would look something like this..

    Code:
    local AmmoID = 7367                   ---Id of Ammo To refill  <<Royal spear 7378>>>
    local MaxAmmo = 24                 --------How many ammo you wanna withdraw from depot                          
    local AmmoDP = 2	                   -- Slot of DP that will be for your ammunition.  0 is first backpack 1 is second backpack 2 is third backpack ETC
    
    Targeting.Start()
    Looter.Start()
    
    function onWalkerSelectLabel(labelName)
    
         if (labelName == "start") then
    		if (blah blah) then
    			Walker.Goto("gotown")
    		elseif (blah blah) then
    			Walker.Goto("go town")
         elseif(label == "Spearwithdraw") then
    		Container.GetByName("Locker"):OpenChildren({3502, true})            -- Opens depot chest
            wait(500,600)
        Container.GetByName("Locker"):Close()                               -- Closes locker
            wait(500,600)
            Self.WithdrawItems(AmmoDP, {AmmoID, 0, MaxAmmo-Self.ItemCount(AmmoID)}) -- 3 means from third backpack in DP, Ammo is ammunition ID, 0 means to first backpack you hold, last "number" is an amount to withdraw.
    The above is a very poor example, but hopefully you get what I mean. If you are having problems you can send me your lua and I will help you out with it.
    Last edited by zxzero; 09-24-2016 at 05:07 PM. Reason: maybe wrong section. :P

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •