Hi,
sometimes i get the following Error over and over:
Line 244 is the following:
add is a list, generated one line ahead:
detectadds():
Can you give me a hint whats wrong?
It often happens, if a target immediately gets out of range, or dies. Do i miss any checks?
sometimes i get the following Error over and over:
Code:
[11:16:07:954] System.NullReferenceException: Object reference not set to an instance of an object.
at HandnavisBearTank.Classname.Combat() in c:\Users\Stefan\Downloads\Honorbuddy_2.0.0.5104\CustomClasses\HandnavisBearTank\HandnavisBearTank.cs:line 244
at Styx.Bot.CustomBots.CombatBot.<CreateCombatBehavior>b__1e(Object ret) in c:\Users\Stefan\Downloads\Honorbuddy_2.0.0.5104\Bots\CombatBot.cs:line 235
Line 244 is the following:
Code:
if (!Me.CurrentTarget.IsFriendly && Me.CurrentTarget != null && Me.CurrentTarget.IsAlive == true && add.Count == 1 && Me.Mounted == false) //BESERK TIME
add is a list, generated one line ahead:
Code:
add = detectAdds();
detectadds():
Code:
//Credit to CodeNameGamma for detectAdds code
private List<WoWUnit> add = new List<WoWUnit>();
private List<WoWUnit> detectAdds()
{
List<WoWUnit> addList = ObjectManager.GetObjectsOfType<WoWUnit>(false).FindAll(unit =>
unit.Guid != Me.Guid &&
unit.Distance < 10.00 &&
(unit.IsTargetingMyPartyMember || unit.IsTargetingMyRaidMember || unit.IsTargetingMeOrPet) &&
!unit.IsFriendly &&
!unit.IsPet &&
!Styx.Logic.Blacklist.Contains(unit.Guid));
return addList;
}
Can you give me a hint whats wrong?
It often happens, if a target immediately gets out of range, or dies. Do i miss any checks?