Any ideas?

Server Crash Report
===================

RunUO Version 0.5, Build 6241.26525
Operating System: Microsoft Windows NT 6.2.9200.0
.NET Framework: 4.0.30319.42000
Time: 4/11/2017 1:30:48 PM
Mobiles: 5900
Items: 172223
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Xanthos.Evo.EvoMageAI.DoOrderGuard()
at Server.Mobiles.BaseAI.AITimer.OnTick()
at Server.Timer.Slice() in C:\Users\John\Downloads\ServUOREPACk\Server\Timer.cs:line 393
at Server.Core.Main(String[] args) in C:\Users\John\Downloads\ServUOREPACk\Server\Main.cs:line 576
 
you would go into the EvoMageAI, then to the function DoOrderGuard and see why there is whatever variable null that is getting read inside the method
 
This is the whole DoOrderGuard

public override bool DoOrderGuard()
{
if ( m_Mobile.IsDeadPet )
return true;

Mobile controlMaster = m_Mobile.ControlMaster;

if ( controlMaster == null || controlMaster.Deleted )
return true;

IDamageable combatant = m_Mobile.Combatant;

List<AggressorInfo> aggressors = controlMaster.Aggressors;

if ( aggressors.Count > 0 )
{
for ( int i = 0; i < aggressors.Count; ++i )
{
AggressorInfo info = aggressors[ i ];
Mobile attacker = info.Attacker;

if ( attacker != null && !attacker.Deleted && attacker.GetDistanceToSqrt( m_Mobile ) <= m_Mobile.RangePerception )
{
if ( combatant == null || ((Mobile)attacker).GetDistanceToSqrt( controlMaster ) < ((Mobile)combatant).GetDistanceToSqrt( controlMaster ) )
{
if ( ( attacker is PlayerMobile && m_CanAttackPlayers ) || !( attacker is PlayerMobile ) )
combatant = attacker;
}
}
}

if ( combatant != null )
m_Mobile.DebugSay( "Crap, my master has been attacked! I will atack one of those bastards!" );
}

if ( combatant != null && combatant != m_Mobile && combatant != m_Mobile.ControlMaster && !combatant.Deleted && combatant.Alive && !((Mobile)m_Mobile.Combatant).IsDeadBondedPet && m_Mobile.CanSee( combatant ) && m_Mobile.CanBeHarmful( combatant, false ) && combatant.Map == m_Mobile.Map )
{
m_Mobile.DebugSay( "Guarding from target..." );

m_Mobile.Combatant = combatant;
m_Mobile.FocusMob = combatant;
Action = ActionType.Combat;

/*
* We need to call Think() here or spell casting monsters will not use
* spells when guarding because their target is never processed.
*/
Think();
}
else
{
m_Mobile.DebugSay( "Nothing to guard from" );

m_Mobile.Warmode = false;

WalkMobileRange( controlMaster, 1, false, 0, 1 );
}

return true;
}
}
}
 
It would be helpful if you could reproduce the crash in debug mode. Most of the code is already checking for null values but I see a couple of spots that might be a problem. Is it a consistent crash?

You could try stuff like this: Change the first if statement in that method to
Code:
            if ( m_Mobile == null || m_Mobile.IsDeadPet )
                return true;

To be extra safe you could check each AggressorInfo[ i ] in that for loop and see if they are null before trying to access info.Attacker.
 
Yes its constant. The funny thing is, if the pet is guarding before you go into combat, its fine. If you enter into combat, the server crashes.

Tried your fix, still crashes.
 
Last edited:
Kind of dredging up an old post here, but I'm running into the same issue with my production shard. Just wondering if this has been fixed?

This is the full error it throws:
Code:
Server Crash Report
===================

RunUO Version 0.5, Build 6482.4249
Operating System: Microsoft Windows NT 6.2.9200.0
.NET Framework: 4.0.30319.42000
Time: 10/8/2017 9:44:43 PM
Mobiles: 4149
Items: 142459
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Xanthos.Evo.EvoMageAI.DoOrderGuard() in f:\ER-Redux_Server\Scripts\Custom\Systems\Xanthos Systems\EVO System\AI\EvoMageAI.cs:line 74
   at Server.Mobiles.BaseAI.Obey() in f:\ER-Redux_Server\Scripts\Mobiles\AI\BaseAI.cs:line 1158
   at Server.Mobiles.BaseAI.AITimer.OnTick() in f:\ER-Redux_Server\Scripts\Mobiles\AI\BaseAI.cs:line 3219
   at Server.Timer.Slice() in F:\ER-Redux_Server\Server\Timer.cs:line 393
   at Server.Core.Main(String[] args) in F:\ER-Redux_Server\Server\Main.cs:line 576

Clients:
- Count: 1
+ 127.0.0.1: (account = clark77) (mobile = 0x393 'Macros the Black')

The section of code it's referring to is this:
Code:
if ( combatant != null && combatant != m_Mobile && combatant != m_Mobile.ControlMaster && !combatant.Deleted && combatant.Alive && !((Mobile)m_Mobile.Combatant).IsDeadBondedPet && m_Mobile.CanSee( combatant ) && m_Mobile.CanBeHarmful( combatant, false ) && combatant.Map == m_Mobile.Map )
{
m_Mobile.DebugSay( "Guarding from target..." );

m_Mobile.Combatant = combatant;
m_Mobile.FocusMob = combatant;
Action = ActionType.Combat;

/*
* We need to call Think() here or spell casting monsters will not use
* spells when guarding because their target is never processed.
*/
Think();
}
 
The first line there has the potential to cause the Null Reference Exception. I would change it to this:

Code:
    if ( combatant != null &&
        combatant != m_Mobile &&
        combatant != m_Mobile.ControlMaster &&
        !combatant.Deleted &&
        combatant.Alive &&
        !(m_Mobile.Combatant is Mobile && ((Mobile)m_Mobile.Combatant).IsDeadBondedPet) &&
        m_Mobile.CanSee( combatant ) &&
        m_Mobile.CanBeHarmful( combatant, false ) &&
        combatant.Map == m_Mobile.Map
    )
 
That did the trick, @Lokai thanks! It should be noted that that line has to be changed in all 4 of the Evo AI scripts in case anyone else comes across this
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back