Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function CastBetweenUnits(unit,unit2,spell) --/run CastBetweenUnits("player","target","Efflorescence",20)
- if NeP.DSL:Get('exists')(unit) and NeP.DSL:Get('exists')(unit2) then
- local distance = GetDistanceBetweenObjects (unit, unit2)
- local X,Y,Z = GetPositionBetweenObjects(unit, unit2, distance /2)
- CastSpellByName(GetSpellInfo(spell))
- ClickPosition(X,Y,Z)
- CancelPendingSpell() end end
- function GetDistanceBetweenPositions (X1, Y1, Z1, X2, Y2, Z2)
- return math.sqrt(math.pow(X2 - X1, 2) + math.pow(Y2 - Y1, 2) + math.pow(Z2 - Z1, 2));
- end
- local icon_eff_smart = "Interface\\Icons\\inv_misc_herb_talandrasrose"
- local SpellRadius = 10
- NeP.Actions:Add("CastEfflorescenceAuto", function(eval)
- eval.exe = function(eva)
- if not NeP.DSL:Get("toggle")(nil, "EffloAuto") or NeP.DSL:Get('area.friendly')("player",'40') ==1 then return false end
- local tempTable = {}
- 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
- tempTable[#tempTable+1] = {
- key = Obj.key,
- MostUnits = NeP.DSL:Get('area.friendly')(Obj.key,SpellRadius)
- }
- end end
- table.sort( tempTable, function(a,b) return a.MostUnits > b.MostUnits end)
- local counter = 0
- for index in pairs(tempTable) do
- counter = counter + 1 end
- if counter > 1 then
- local X5,Y5,Z5 = ObjectPosition(tempTable[1].key)
- local X1,Y1,Z1 = ObjectPosition("player")
- local distance4 = GetDistanceBetweenObjects (tempTable[1].key, tempTable[4].key)
- local distance3 = GetDistanceBetweenObjects (tempTable[1].key, tempTable[3].key)
- local distance2 = GetDistanceBetweenObjects (tempTable[1].key, tempTable[2].key)
- local X4,Y4,Z4 = GetPositionBetweenObjects(tempTable[1].key, tempTable[4].key, distance4 /2)
- local X3,Y3,Z3 = GetPositionBetweenObjects(tempTable[1].key, tempTable[3].key, distance3 /2)
- local X2,Y2,Z2 = GetPositionBetweenObjects(tempTable[1].key, tempTable[2].key, distance2 /2)
- if GetDistanceBetweenPositions(X1,Y1,Z1,X4,Y4,Z4) <40 and GetDistanceBetweenPositions(X5,Y5,Z5,X4,Y4,Z4) < SpellRadius then
- CastBetweenUnits(tempTable[1].key,tempTable[4].key,"Efflorescence")
- NeP.ActionLog:Add("Auto Ground Cast", "Casting Efflorescence near", icon_eff_smart, tempTable[4].key) elseif
- GetDistanceBetweenPositions(X1,Y1,Z1,X3,Y3,Z3) <40 and GetDistanceBetweenPositions(X5,Y5,Z5,X3,Y3,Z3) < SpellRadius then
- CastBetweenUnits(tempTable[1].key,tempTable[3].key,"Efflorescence")
- NeP.ActionLog:Add("Auto Ground Cast", "Casting Efflorescence near", icon_eff_smart, tempTable[3].key) elseif
- GetDistanceBetweenPositions(X1,Y1,Z1,X2,Y2,Z2) <40 and GetDistanceBetweenPositions(X5,Y5,Z5,X2,Y2,Z2) < SpellRadius then
- CastBetweenUnits(tempTable[1].key,tempTable[2].key,"Efflorescence")
- NeP.ActionLog:Add("Auto Ground Cast", "Casting Efflorescence near", icon_eff_smart, tempTable[2].key)
- return true end end end return true end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement