Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. function GetDistanceBetweenPositions (X1, Y1, Z1, X2, Y2, Z2)
  2. return math.sqrt(math.pow(X2 - X1, 2) + math.pow(Y2 - Y1, 2) + math.pow(Z2 - Z1, 2));
  3. end
  4.  
  5. local icon_eff_smart = "Interface\\Icons\\inv_misc_herb_talandrasrose"
  6. NeP.Actions:Add("CastEfflorescenceAuto", function(eval)
  7. eval.exe = function(eva)
  8. if not NeP.DSL:Get("toggle")(nil, "EffloAuto") or NeP.DSL:Get('area.friendly')("player",'40') ==1 then return false end
  9. local tempTable = {}
  10. 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
  11. tempTable[#tempTable+1] = {
  12. key = Obj.key,
  13. MostUnits = NeP.DSL:Get('area.friendly')(Obj.key,'10')
  14. }
  15. end end
  16. table.sort( tempTable, function(a,b) return a.MostUnits > b.MostUnits end)
  17. local counter = 0
  18. for index in pairs(tempTable) do
  19. counter = counter + 1 end
  20. if counter > 1 then
  21. local X5,Y5,Z5 = ObjectPosition("player")
  22. local X1,Y1,Z1 = ObjectPosition(tempTable[1].key)
  23. local X2,Y2,Z2 = ObjectPosition(tempTable[2].key)
  24. local X3,Y3,Z3 = ObjectPosition(tempTable[3].key)
  25. local X4,Y4,Z4 = ObjectPosition(tempTable[4].key)
  26.  
  27. if GetDistanceBetweenPositions(X1,Y1,Z1,X4,Y4,Z4) <10 and GetDistanceBetweenPositions(X1,Y1,Z1,X5,Y5,Z5 ) <40 then
  28. CastBetweenUnits(tempTable[1].key,tempTable[4].key,"Efflorescence")
  29. NeP.ActionLog:Add("Auto Ground Cast", "Casting Efflorescence near", icon_eff_smart, tempTable[4].key) elseif
  30.  
  31. GetDistanceBetweenPositions(X1,Y1,Z1,X3,Y3,Z3) <10 and GetDistanceBetweenPositions(X1,Y1,Z1,X5,Y5,Z5) <40 then
  32. CastBetweenUnits(tempTable[1].key,tempTable[3].key,"Efflorescence")
  33. NeP.ActionLog:Add("Auto Ground Cast", "Casting Efflorescence near", icon_eff_smart, tempTable[3].key) elseif
  34.  
  35. GetDistanceBetweenPositions(X1,Y1,Z1,X2,Y2,Z2) <10 and GetDistanceBetweenPositions(X1,Y1,Z1,X5,Y5,Z5) <40 then
  36. CastBetweenUnits(tempTable[1].key,tempTable[2].key,"Efflorescence")
  37. NeP.ActionLog:Add("Auto Ground Cast", "Casting Efflorescence near", icon_eff_smart, tempTable[2].key)
  38. return true end end end return true end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement