Mobs on my server mysteriously stopped receiving EnemyHealed events. A quick search of the entire project revealed there's only one origin for EnemyHealed events, and it's in GameLiving.ChangeHealth. If my health changes, and it's the result of a heal (rather than health regen), I notify all my attackers with an EnemyHealed event. In quick look at the SVN history for GameLiving.cs I didn't see any recent changes to this method.
So here's the kicker:
Why did this ever work? It looks like it notifies all of your attackers of the EnemyHealed event except for the one you have targeted.
- Code: Select all
foreach (GameObject attacker in attackers)
{
if (attacker is GameLiving && attacker != TargetObject)
{
(attacker as GameLiving).Notify(GameLivingEvent.EnemyHealed, (GameLiving)attacker, args);
(attacker as GameLiving).AddXPGainer(changeSource, healthChanged);
}
}
- Code: Select all
foreach ( GameLiving attacker in attackers )
{
if ( attacker != null )
{
attacker.Notify( GameLivingEvent.EnemyHealed, attacker, args );
attacker.AddXPGainer( changeSource, healthChanged );
}
}
