Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. function xShieldSaves()
  2. if GetRaidRosterInfo(1) then
  3. for i=1,GetNumRaidMembers() do
  4. if healthPct("raid"..i) < .25 and xUnitInRange("raid"..i) and not buffed("Weakened Soul", "raid"..i) and IsAlive("raid"..i) then
  5. TargetUnit("raid"..i);
  6. CastSpellByName("Power Word: Shield")
  7. TargetLastTarget();
  8. local shieldname = UnitName("raid"..i)
  9. RunLine("/raid i put PWS on "..shieldname)
  10. return
  11. end
  12. end
  13. elseif GetNumPartyMembers() > 0 then
  14. for i=1,GetNumPartyMembers() do
  15. if (healthPct("party"..i) < 0.25) and not buffed("Weakened Soul", "party"..i) then
  16. TargetUnit("party"..i);
  17. CastSpellByName("Power Word: Shield")
  18. TargetLastTarget();
  19. local shieldname = UnitName("party"..i)
  20. RunLine("/raid i put PWS on "..shieldname)
  21. return
  22. end
  23. end
  24. end
  25. end
  26.  
  27.  
  28. --you call it with this:
  29. --[[--
  30.  
  31. if not ImBusy() and spellReady("Power Word: Shield") and InCombat() then
  32. if (Shield_wait == nil or GetTime()-Shield_wait > 2.5) then
  33. Shield_wait = GetTime();
  34. xShieldSaves()
  35. end
  36. end
  37.  
  38. --]]--
  39.  
  40.  
  41.  
  42.  
  43. --you prolly have the functions below already.
  44.  
  45. function xUnitInRange(Unit)
  46. if CheckInteractDistance(Unit, 4) then
  47. return true;
  48. end
  49. return nil;
  50. end
  51. function healthPct(unit)
  52. local unit = unit or "player"
  53. return UnitHealth(unit) / UnitHealthMax(unit)
  54. end
  55. function IsAlive(id)
  56. if not id then return end
  57. if UnitName(id) and (not UnitIsDead(id) and UnitHealth(id)>1 and not UnitIsGhost(id) and UnitIsConnected(id)) then return true end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement