Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. local CLOCK
  2. local gptimer=os.clock()-.40
  3. local energyring=3051
  4. local energyring_active=3088
  5. local normalring=12737
  6. local percenthp=40
  7. local checkspeed=.1
  8. local oldnum=0
  9. local oldslot=0
  10.  
  11. function AutoEnergyRing()
  12. CLOCK=os.clock()
  13. if (CLOCK-gptimer<checkspeed) then return 0; end
  14. gptimer=CLOCK
  15. if (self.hp<(percenthp*self.hpmax)/100 and self.ring~=energyring) then
  16. local gp=FindItem(energyring)
  17. if (gp~=nil) then
  18. ThrowItemCtoI(gp.num,gp.slot,SLOT_RING,energyring,1)
  19. oldnum=gp.num
  20. oldslot=gp.slot
  21. gptimer=CLOCK+.4
  22. end
  23. return
  24. end
  25. if (self.hp>self.hpmax-10 and self.ring==energyring_active and normalring>0) then
  26. local gp=FindItem(normalring)
  27. if (gp~=nil) then
  28. ThrowItemCtoI(gp.num,gp.slot,SLOT_RING,normalring,1)
  29. end
  30. return
  31. end
  32. if (self.hp>self.hpmax-20 and self.ring==energyring_active and normalring==0) then
  33. print("unloading")
  34. ThrowItemItoC(SLOT_RING,oldnum,oldslot,energyring_active,1)
  35. gptimer=CLOCK+1
  36. end
  37. end
  38.  
  39.  
  40. SetTimerCallback("AutoEnergyRing")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement