Advertisement
Guest User

Untitled

a guest
Jan 27th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.30 KB | None | 0 0
  1. --[[
  2. Instructions:
  3. Attacks are prioritized least to greatest.
  4.  
  5. Required parameters:
  6. words = spell words or rune id
  7. min = minimum monster amount to trigger spell/rune
  8. distance = the max range of the attack
  9.  
  10. Optional parameters:
  11. max = the max monsters the spell will attack
  12. mana = the minimum mana you want to have before casting
  13. padding = the extra sqm's to check for players PAST the attack distance (default is 0)
  14. needsTarget = the attack needs a target (exori hur, etc)
  15. needsDirection = spells most effective when facing target (exori min)
  16. multiFloor = check for players above/below (stairhop skulling)
  17. ignoreParty = ignore player checks for party members
  18. whiteList = table of players to ignore
  19. targetList = table of monsters to attack, to attack all do not specify this option
  20.  
  21. ]]
  22.  
  23.  
  24. attack = {}
  25. attack[1] = {words="exori gran", min=5, distance=1, padding=2, multiFloor=true, ignoreParty=false, whiteList={"Syntax", "DarkstaR"}}
  26. attack[2] = {words="exori", min=3, distance=1, padding=2, multiFloor=true, ignoreParty=true}
  27. attack[3] = {words="exori hur", min=1, max=3, needsTarget=true, distance=1, padding=0, multiFloor=false, ignoreParty=true}
  28. attack[4] = {words="exori ico", min=1, max=3, needsTarget=true, distance=1, padding=0, multiFloor=false, ignoreParty=true}
  29.  
  30.  
  31. function getTargetCount(distance, padding, multiFloor, ignoreParty, whiteList, targetList)
  32. local n = 0
  33. padding = padding or 0
  34. whiteList = whiteList or {}
  35. targetList = targetList or {}
  36. for i = CREATURES_LOW, CREATURES_HIGH do
  37. local cid = Creature.GetFromIndex(i)
  38. local checkPad = cid:isPlayer() and padding or 0
  39. if(cid:isValid() and cid:isVisible() and cid:isAlive() and cid:DistanceFromSelf() <= (distance + checkPad) and not cid:isSelf())then
  40. if(getSelfPosition().z == cid:Position().z or (multiFloor and cid:isPlayer()))then
  41. if(cid:isPlayer() and (not cid:isPartyMember() or not ignoreParty) and not table.find(whiteList, cid:Name(), false))then
  42. return 0
  43. elseif(cid:isMonster() and (table.find(targetList, cid:Name(), false) or #targetList<1))then
  44. n = n + 1
  45. end
  46. end
  47. end
  48. end
  49. return n
  50. end
  51.  
  52. function main()
  53. for i = 1, #attack do
  54. local atk = attack[i]
  55. local count = getTargetCount(atk.distance, atk.padding, atk.multiFloor, atk.ignoreParty, atk.whiteList, atk.targetList)
  56. if(count > 0)then
  57. if(count >= atk.min and count <= ((atk.max == nil) and count or atk.max))then
  58. if(type(atk.words) == 'number')then
  59. Self.UseItemWithMe(atk.words)
  60. wait(900, 1200)
  61. elseif(Self.CanCastSpell(atk.words) and (not atk.mana or Self.Mana() >= atk.mana))then
  62. local target = Creature.GetByID(Self.TargetID())
  63. if(atk.needsTarget or atk.needsDirection)then
  64. if(target:isOnScreen() and target:isVisible() and target:isAlive())then
  65. if(target:DistanceFromSelf() <= atk.distance)then
  66. if(atk.needsDirection)then
  67. local pos, toPos = getSelfPosition(), target:Position()
  68. local dir = pos.x > toPos.x and WEST or pos.x < toPos.x and EAST or pos.y > toPos.y and NORTH or SOUTH
  69. Self.Turn(dir)
  70. wait(100, 200)
  71. else
  72. Self.Say(atk.words)
  73. end
  74. end
  75. end
  76. end
  77. if(not atk.needsTarget)then
  78. Self.Say(atk.words)
  79. end
  80. wait(600, 1000)
  81. end
  82. end
  83. end
  84. end
  85. end
  86.  
  87. print([[
  88. Name: Auto Area Attack
  89. Description: Shoots area spells/rune on certain conditions
  90. Author: Cavitt Glover (Syntax)
  91. Version: 5.0.00 (updated 11.26.2012)]])
  92. wait(2000)
  93.  
  94. registerEventListener(TIMER_TICK, "main")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement