//========================================================= // PrescheduleThink //========================================================= void CAGrunt :: PrescheduleThink ( void ) { if ( ShouldSpeak() ) { if ( m_flNextWordTime < gpGlobals->time ) { int num = -1; do { num = RANDOM_LONG(0,ARRAYSIZE(pIdleSounds)-1); } while( num == m_iLastWord ); m_iLastWord = num; // play a new sound EMIT_SOUND ( ENT(pev), CHAN_VOICE, pIdleSounds[ num ], 1.0, ATTN_NORM ); // is this word our last? if ( RANDOM_LONG( 1, 10 ) <= 1 ) { // stop talking. StopTalking(); } else { m_flNextWordTime = gpGlobals->time + RANDOM_FLOAT( 0.5, 1 ); } } } }
//========================================================= // PrescheduleThink //========================================================= void CNPC_AlienGrunt::PrescheduleThink ( void ) { BaseClass::PrescheduleThink(); if ( ShouldSpeak() ) { if ( m_flNextWordTime < gpGlobals->curtime ) { // play a new sound CPASAttenuationFilter filter( this ); EmitSound( filter, entindex(), "AlienGrunt.Idle" ); // is this word our last? if ( random->RandomInt( 1, 10 ) <= 1 ) { // stop talking. StopTalking(); } else { m_flNextWordTime = gpGlobals->curtime + random->RandomFloat( 0.5, 1 ); } } } }
//========================================================= // AttackSound //========================================================= void CNPC_AlienGrunt::AttackSound( void ) { StopTalking(); CPASAttenuationFilter filter( this ); EmitSound( filter, entindex(), "AlienGrunt.Attack" ); }
//========================================================= // DieSound //========================================================= void CNPC_AlienGrunt::DeathSound( const CTakeDamageInfo &info ) { StopTalking(); CPASAttenuationFilter filter( this ); EmitSound( filter, entindex(), "AlienGrunt.Die" ); }
void CAI_PlayerAlly::Event_Killed( const CTakeDamageInfo &info ) { AlertFriends( info.GetAttacker() ); SetTarget( NULL ); // Don't finish that sentence StopTalking(); SetUse( NULL ); BaseClass::Event_Killed( info ); }
//========================================================= // PainSound //========================================================= void CAGrunt :: PainSound ( void ) { if ( m_flNextPainTime > gpGlobals->time ) { return; } m_flNextPainTime = gpGlobals->time + 0.6; StopTalking(); EMIT_SOUND ( ENT(pev), CHAN_VOICE, pPainSounds[RANDOM_LONG(0,ARRAYSIZE(pPainSounds)-1)], 1.0, ATTN_NORM ); }
//========================================================= // PainSound //========================================================= void CNPC_AlienGrunt::PainSound( const CTakeDamageInfo &info ) { if ( m_flNextPainTime > gpGlobals->curtime ) { return; } m_flNextPainTime = gpGlobals->curtime + 0.6; StopTalking(); CPASAttenuationFilter filter( this ); EmitSound( filter, entindex(),"AlienGrunt.Pain" ); }
void CTalkMonster::Killed( const CTakeDamageInfo& info, GibAction gibAction ) { // If a client killed me (unless I was already Barnacle'd), make everyone else mad/afraid of him if ( info.GetAttacker() && info.GetAttacker()->GetFlags().Any( FL_CLIENT ) && m_MonsterState != MONSTERSTATE_PRONE ) { AlertFriends(); LimitFollowers( info.GetAttacker(), 0 ); } m_hTargetEnt = NULL; // Don't finish that sentence StopTalking(); SetUse( NULL ); CBaseMonster::Killed( info, gibAction ); }
void CMTalkMonster :: Killed( entvars_t *pevAttacker, int iGib ) { // If a client killed me (unless I was already Barnacle'd), make everyone else mad/afraid of him if ( (pevAttacker->flags & FL_CLIENT) && m_MonsterState != MONSTERSTATE_PRONE ) { AlertFriends(); LimitFollowers( ENT(pevAttacker), 0 ); } m_hTargetEnt = NULL; // Don't finish that sentence StopTalking(); SetUse( NULL ); CMBaseMonster::Killed( pevAttacker, iGib ); }
//========================================================= // AttackSound //========================================================= void CAGrunt :: AttackSound ( void ) { StopTalking(); EMIT_SOUND ( ENT(pev), CHAN_VOICE, pAttackSounds[RANDOM_LONG(0,ARRAYSIZE(pAttackSounds)-1)], 1.0, ATTN_NORM ); }