I want to make an NPC (who is an enemy of the player) attack another NPC who accidentally damaged him. For example, if a monster_zombie is hit by a lightning bolt launched by a monster_alien_slave, then the former starts fighting the latter (ignoring the player momentarily).
So far, I did this that gives me error:
In zombie.cpp:
int CZombie :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
// Trying to accomplish, unsuccessfully, monster infighting
if ( pevAttacker->flags & FL_MONSTER )
{
ALERT( at_console, "Monster infighting!\n" );
m_hEnemy->pev = pevAttacker;
}
(...)
}
Once the monster_zombie takes damage from, in this case, a monster_alien_slave that launched its beam, the console displays the following message:"Host_Error: WriteDest_Parm: not a client". And the game ends.
Maybe what I did is wrong (most likely.) Does anyone know how to achieve the monster infighting in Half-Life (if possible)?
Also, I want that once the monster_zombie has killed the monster_alien_slave (or simply the latter has died for another reason), the former starts attacking the player again.
Thanks in advance.