findBestClickPoint changes
Posted: Tue Dec 31, 2013 4:21 pm
I think it is better to make a spinoff thread for that the other is already very long.
Okay I stated to made a changed version of findBestClickPoint even I don't like it very much and at the end I was forced to review to code again.
So first I changed the header, so I can overwrite with an custom evalFunc :
then I have found something strange:
that itself isn't strange but it make the follow code pointless because if I remember correctly if something is nil its also false.
that or 0.5 > math.abs(obj.Y - self.Y) will never make a difference, because it will be never reached in case if (settings.profile.options.FORCE_BETTER_AOE_TARGETING is nil or false.
Best compromises would be(so you can have on/off/deactivated):
I personal would use instead of "0.5 > math.abs(obj.Y - self.Y) "use multiply layers so I can see if their are groups of mobs on the some high level and choose the layer with the most mobs at the end.
Okay I stated to made a changed version of findBestClickPoint even I don't like it very much and at the end I was forced to review to code again.
So first I changed the header, so I can overwrite with an custom evalFunc :
Code: Select all
function CPawn:findBestClickPoint(aoerange, skillrange, onlyaggro, evalFunc)
-- Finds best place to click to get most mobs including this pawn.
self:updateXYZ()
player:updateXYZ()
local MobList = {}
local EPList = {}
if( type(evalFunc) ~= "function" ) then
--default func
evalFunc = function (address,pawn)
if pawn.Alive and pawn.HP >=1 and pawn.Attackable and pawn.Level > 1 then
return true
else
return false
end
end;
end
Code: Select all
-- Check if user wants to bypass this function
-- Blubblab:c I'dont need that for AndorTraining
-- if settings.profile.options.FORCE_BETTER_AOE_TARGETING == false then
-- return countmobs, self.X, self.Z
-- end
Code: Select all
if obj ~= nil and obj.Type == PT_MONSTER and (settings.profile.options.FORCE_BETTER_AOE_TARGETING == true or 0.5 > math.abs(obj.Y - self.Y))
that or 0.5 > math.abs(obj.Y - self.Y) will never make a difference, because it will be never reached in case if (settings.profile.options.FORCE_BETTER_AOE_TARGETING is nil or false.
Best compromises would be(so you can have on/off/deactivated):
Code: Select all
if settings.profile.options.FORCE_BETTER_AOE_TARGETING~=nil and settings.profile.options.FORCE_BETTER_AOE_TARGETING == false then
return countmobs, self.X, self.Z
end
I personal would use instead of "0.5 > math.abs(obj.Y - self.Y) "use multiply layers so I can see if their are groups of mobs on the some high level and choose the layer with the most mobs at the end.