Advertisement
a3f

[XB] Swap [X]Bow for Stars+Shield and back

a3f
Aug 31st, 2012
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. dofile("Forgee.lua")
  2.  
  3. function equipShield()
  4.     local SHIELDID = 3420 -- Shield ID (6390 = nightmare, 3420 = demon)
  5.     local BACKUPWEPID = 7368 -- Backup weapon ID (sin stars = 7368)
  6.    
  7.     local TWOHANDERID = 8027 -- [x]bow id -- 8027 = hornbow
  8.    
  9.     local RADIUSTOCHECK = 1 -- directly next to you
  10.     local CRITICALAMOUNT = 2 -- how many monsters should be within the radius above to make u switch
  11.     local SAFEDISTANCE = 3 -- how many monsters should be farther than that to siwtch to bow back
  12.    
  13.     --local CRITICALHEALTH = 30 -- % of health to resort to shield-star combination (not implemented yet)
  14.    
  15.     local BACKPACKNAME = 'Orange Backpack' -- Backpack where backup stuff are in
  16.  
  17.     --!!!!!!!!!!!!!!!!!!!!!!!
  18.     --!!!DO NOT EDIT BELOW!!!
  19.     --!!!!!!!!!!!!!!!!!!!!!!!
  20.     local Backpack = Container.GetByName(BACKPACKNAME)
  21.     if (monstersAround(RADIUSTOCHECK) >= CRITICALAMOUNT) then
  22.         for Spot = 0, Backpack:ItemCount() do
  23.             local Shield = Backpack:GetItemData(Spot)
  24.             if (Shield.id == SHIELDID) then
  25.                 Backpack:MoveItemToEquipment(Spot, "shield")
  26.             break
  27.             end
  28.         end
  29.         for Spot = 0, Backpack:ItemCount() do
  30.             local Wep = Backpack:GetItemData(Spot)
  31.             if (Wep.id == BACKUPWEPID) then
  32.                 Backpack:MoveItemToEquipment(Spot, "weapon")
  33.             break
  34.             end
  35.         end
  36.     elseif (monstersAround(SAFEDISTANCE) == 0 and (Self.Weapon().id ~= TWOHANDERID)) then
  37.         for Spot = 0, Backpack:ItemCount() do
  38.             local Twohander = Backpack:GetItemData(Spot)
  39.             if (Twohander.id == TWOHANDERID) then
  40.                 Backpack:MoveItemToEquipment(Spot, "weapon")
  41.             end
  42.         end
  43.     end
  44. end
  45.  
  46. while (true) do
  47.     equipShield()
  48.     wait(1000,1500)
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement