Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. function CastBetweenUnits(unit,unit2,spell) --/run CastBetweenUnits("player","target","Efflorescence",20)
  2. if NeP.DSL:Get('exists')(unit) and NeP.DSL:Get('exists')(unit2) then
  3. local distance = GetDistanceBetweenObjects (unit, unit2)
  4. local X,Y,Z = GetPositionBetweenObjects(unit, unit2, distance /2)
  5. CastSpellByName(GetSpellInfo(spell))
  6. ClickPosition(X,Y,Z)
  7. CancelPendingSpell() end end
  8.  
  9. function GetDistanceBetweenPositions (X1, Y1, Z1, X2, Y2, Z2)
  10. return math.sqrt(math.pow(X2 - X1, 2) + math.pow(Y2 - Y1, 2) + math.pow(Z2 - Z1, 2));
  11. end
  12.  
  13. local icon_eff_smart = "Interface\\Icons\\inv_misc_herb_talandrasrose"
  14. local SpellRadius = 10
  15. NeP.Actions:Add("CastEfflorescenceAuto", function(eval)
  16. eval.exe = function(eva)
  17. if not NeP.DSL:Get("toggle")(nil, "EffloAuto") or NeP.DSL:Get('area.friendly')("player",'40') ==1 then return false end
  18. local tempTable = {}
  19. for _, Obj in pairs(NeP.OM:Get('Friendly')) do if NeP.DSL:Get('exists')(Obj.key) and NeP.DSL:Get("inRange")(Obj.key) and NeP.DSL:Get("alive")(Obj.key) then
  20. tempTable[#tempTable+1] = {
  21. key = Obj.key,
  22. MostUnits = NeP.DSL:Get('area.friendly')(Obj.key,SpellRadius)
  23. }
  24. end end
  25. table.sort( tempTable, function(a,b) return a.MostUnits > b.MostUnits end)
  26. local counter = 0
  27. for index in pairs(tempTable) do
  28. counter = counter + 1 end
  29. if counter > 1 then
  30. local X5,Y5,Z5 = ObjectPosition(tempTable[1].key)
  31. local X1,Y1,Z1 = ObjectPosition("player")
  32. local distance4 = GetDistanceBetweenObjects (tempTable[1].key, tempTable[4].key)
  33. local distance3 = GetDistanceBetweenObjects (tempTable[1].key, tempTable[3].key)
  34. local distance2 = GetDistanceBetweenObjects (tempTable[1].key, tempTable[2].key)
  35. local X4,Y4,Z4 = GetPositionBetweenObjects(tempTable[1].key, tempTable[4].key, distance4 /2)
  36. local X3,Y3,Z3 = GetPositionBetweenObjects(tempTable[1].key, tempTable[3].key, distance3 /2)
  37. local X2,Y2,Z2 = GetPositionBetweenObjects(tempTable[1].key, tempTable[2].key, distance2 /2)
  38.  
  39. if GetDistanceBetweenPositions(X1,Y1,Z1,X4,Y4,Z4) <40 and GetDistanceBetweenPositions(X5,Y5,Z5,X4,Y4,Z4) < SpellRadius then
  40. CastBetweenUnits(tempTable[1].key,tempTable[4].key,"Efflorescence")
  41. NeP.ActionLog:Add("Auto Ground Cast", "Casting Efflorescence near", icon_eff_smart, tempTable[4].key) elseif
  42.  
  43. GetDistanceBetweenPositions(X1,Y1,Z1,X3,Y3,Z3) <40 and GetDistanceBetweenPositions(X5,Y5,Z5,X3,Y3,Z3) < SpellRadius then
  44. CastBetweenUnits(tempTable[1].key,tempTable[3].key,"Efflorescence")
  45. NeP.ActionLog:Add("Auto Ground Cast", "Casting Efflorescence near", icon_eff_smart, tempTable[3].key) elseif
  46.  
  47. GetDistanceBetweenPositions(X1,Y1,Z1,X2,Y2,Z2) <40 and GetDistanceBetweenPositions(X5,Y5,Z5,X2,Y2,Z2) < SpellRadius then
  48. CastBetweenUnits(tempTable[1].key,tempTable[2].key,"Efflorescence")
  49. NeP.ActionLog:Add("Auto Ground Cast", "Casting Efflorescence near", icon_eff_smart, tempTable[2].key)
  50. return true end end end return true end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement