
function AISMN_Reaction_Defeated::OnEnter(%this,%obj)
{
   %object = GetThisObject(%obj);
	EndAttackLoop(%object, true);
	
	// Should be okay to do both if one or the other is not part of the AI 
	// component
	%obj.StartReaction("defeated",1.0);
	%obj.performAction("die");
	
	if(%object.isOnTeam($OST_PLAYER)) {
      %msg = slgGetUIString("id_character_death");
      %msg = slgFormatUIString(%msg, %object.name);
      commandToClient(ClientGroup.getObject(0), 'SendHudMessage', %msg);
	}
}

function AISMN_Reaction_Defeated::OnExit(%this,%obj)
{
   return;
}

function AISMN_Reaction_Defeated::Update(%this,%obj)
{
   if (GetThisObject(%obj).health <= 0)
      ReturnValue(%obj,-1);
   else
      ReturnValue(%obj,0);
   return;
}
