Advertisement
Jo3Bingham

Slime Trainer by Jo3Bingham

Mar 4th, 2013
2,710
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.16 KB | None | 0 0
  1. --Notes--
  2. --[[
  3. Damage Slime Mother until its health is below 50%.
  4. If you check the 'Advanced Info' (Adv Info) checkbox in Tools, XenoBot will automatically label the Slime Mother for you.
  5. Set your training up where the Slime Mother is attacking you (adjacent to you).
  6. If you're training with small stones, for example, their range is 4, so try to setup training in an area where the slime summons can't get out of range.
  7. Any questions, problems, suggestions, etc., contact Jo3Bingham at XenoBot forums. http://forums.xenobot.net/
  8. ]]--
  9.  
  10. --Slime Trainer Settings--
  11. local CreatureName = 'Slime' -- Name of creature you want to train on.
  12. local CreatureRange = 4 -- Distance from self to get creatures.
  13. local CreatureDistance = 2 -- Minimum distance target creature should be from self.
  14.  
  15. --Weapon Switcher Settings--
  16. local TrainingWeaponID = 1781 -- ID of weapon you are training with. (Default: Small Stones)
  17. local LowHealthWeaponID = 3277 -- ID of weapon you want to switch to when low on health. (Default: Spears)
  18. local LowAmmoWeaponID = 3277 -- ID of weapon you want to switch to when low on ammo. (Default: Spears)
  19.  
  20. local SwitchOnLowHealth = false -- Set to false if you don't want to switch to alternate weapon on low health.
  21. local SwitchLowHealth = math.floor(Self.MaxHealth() * 0.5) -- Your health at which you want to switch to alternate weapon. (Default: 50%)
  22. local SwitchHighHealth = math.floor(Self.MaxHealth() * .75) -- Your health at which you want to switch back to training weapon. (Default: 75%)
  23.  
  24. local SwitchOnLowAmmo = false -- Set to true if you want to switch to alternate weapon on low ammo.
  25. local SwitchAmmoCount = 50 -- Amount of ammo to switch to alternate weapon at.
  26.  
  27. --Slime Mother Killer Settings--
  28. local KillOnLowHealth = true -- Set to false if you don't want to kill slime mother when low on health.
  29. local KillLowHealth = math.floor(Self.MaxHealth() * .35) -- Your health at which you want to kill slime mother.
  30.  
  31. local KillOnLowAmmo = true -- Set to false if you don't want to kill slime mother when low on ammo.
  32. local KillAmmoCount = 25 -- Amount of ammo to kill slime mother at.
  33.  
  34. --Alerts--
  35. local AlertOnWeaponSwitch = false -- Set to true if you want to be alerted when weapon is switched.
  36. local AlertOnLowAmmo = false -- Set to true if you want to be alerted when ammo is switched.
  37. local AlertOnLowHealth = false -- Set to true if you want to be alerted when low on health.
  38. local AlertOnKill = true -- Set to false if you don't want to be alerted when slime mother is killed.
  39.  
  40. --Only edit below if you want to.--
  41. local KillingSlimeMother = false -- Do not change!
  42.  
  43. local SlimeTrainer = Module.New('Slime Trainer', function()
  44.     if (Self.TargetID() == 0) then
  45.         local creatures = Self.GetTargets(CreatureRange)
  46.         for i = 1, #creatures do
  47.             if (creatures[i]:DistanceFromSelf() >= CreatureDistance) then
  48.                 if (creatures[i]:Attack()) then break end
  49.             end
  50.         end
  51.     end
  52. end)
  53.  
  54. local WeaponSwitcher = Module.New('Weapon Switcher', function()
  55.     if (SwitchOnLowHealth) then
  56.         if (Self.Health() <= SwitchLowHealth and Self.Weapon().id ~= LowHealthWeaponID) then
  57.             if (AlertOnLowHealth) then alert() end
  58.             if (MoveWeapon(LowHealthWeaponID) and AlertOnWeaponSwitch) then alert() end
  59.         elseif (Self.Health() >= SwitchHighHealth and Self.Weapon().id ~= TrainingWeaponID) then
  60.             if (MoveWeapon(TrainingWeaponID) and AlertOnWeaponSwitch) then alert() end
  61.         end
  62.     end
  63.     if (SwitchOnLowAmmo) then
  64.         if (Self.Weapon().id == TrainingWeaponID and Self.Weapon().count <= SwitchAmmoCount) then
  65.             if (MoveWeapon(LowAmmoWeaponID) and AlertOnLowAmmo) then alert() end
  66.         end
  67.     end
  68.     wait(1000, 2000)
  69. end, false)
  70.  
  71. local SlimeMotherKiller = Module.New('Slime Mother Killer', function()
  72.     if (KillOnLowHealth) then
  73.         if (Self.Health() <= KillLowHealth) then KillSlimeMother() end
  74.     end
  75.     if (KillOnLowAmmo) then
  76.         if (Self.Weapon().count <= KillAmmoCount) then KillSlimeMother() end
  77.     end
  78.     wait(1000, 2000)
  79. end, false)
  80.  
  81. function MoveWeapon(ItemID)
  82.     local container = Container.GetFirst()
  83.     while (container:isOpen()) do
  84.         for spot = 0, container:ItemCapacity() do
  85.             if (container:GetItemData(spot).id == ItemID) then
  86.                 return (container:MoveItemToEquipment(spot, 'weapon'))
  87.             end
  88.         end
  89.         container = container:GetNext()
  90.     end
  91.     return false
  92. end
  93.  
  94. function KillSlimeMother()
  95.     if not (KillingSlimeMother) then
  96.         SlimeTrainer:Stop()
  97.         Self.StopAttack()
  98.         if (AlertOnLowHealth) then alert() end
  99.         local creatures = Self.GetTargets(1)
  100.         for i = 1, #creatures do
  101.             if (creatures:Name() == 'Slime' and creatures[i]:HealthPercent() <= 50) then
  102.                 if (creatures[i]:Attack()) then break end
  103.             end
  104.         end
  105.     elseif (KillingSlimeMother and Self.TargetID == 0) then
  106.         local creatures = Self.GetTargets(1)
  107.         for i = 1, #creatures do
  108.             if (creatures:Name() == 'Slime' and creatures[i]:HealthPercent() <= 50) then
  109.                 if (creatures[i]:Attack()) then break end
  110.             end
  111.         end
  112.         if (AlertOnKill) then alert() end
  113.         KillingSlimeMother = false
  114.     end
  115. end
  116.  
  117. if (SwitchOnLowHealth or SwitchOnLowAmmo) then WeaponSwitcher:Start() end
  118. if (KillOnLowHealth or KillOnLowAmmo) then SlimeMotherKiller:Start() end
  119.  
  120. local info = [['Slime Trainer' by Jo3Bingham loaded successfully.]]
  121. print(info)
  122. wait(500)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement