void CTalkMonster::PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, const bool bConcurrent, CBaseEntity *pListener ) { if ( !bConcurrent ) ShutUpFriends(); ClearConditions( bits_COND_CLIENT_PUSH ); // Forget about moving! I've got something to say! m_useTime = gpGlobals->time + duration; PlaySentence( pszSentence, duration, volume, attenuation ); m_hTalkTarget = pListener; }
int CAI_PlayerAlly::PlayScriptedSentence( const char *pszSentence, float delay, float volume, soundlevel_t soundlevel, bool bConcurrent, CBaseEntity *pListener ) { if ( !bConcurrent ) ShutUpFriends(); ClearCondition( COND_PLAYER_PUSHING ); // Forget about moving! I've got something to say! int sentenceIndex = BaseClass::PlayScriptedSentence( pszSentence, delay, volume, soundlevel, bConcurrent, pListener ); SetSpeechTarget( pListener ); return sentenceIndex; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- int CNPCSimpleTalker::PlayScriptedSentence( const char *pszSentence, float delay, float volume, soundlevel_t soundlevel, bool bConcurrent, CBaseEntity *pListener ) { if ( !bConcurrent ) ShutUpFriends(); int sentenceIndex = BaseClass::PlayScriptedSentence( pszSentence, delay, volume, soundlevel, bConcurrent, pListener ); delay += engine->SentenceLength( sentenceIndex ); if ( delay < 0 ) delay = 0; m_useTime = gpGlobals->curtime + delay; // Stop all idle speech until after the sentence has completed DeferAllIdleSpeech( delay + random->RandomInt( 3.0f, 5.0f ) ); return sentenceIndex; }
void CTalkMonster :: HandleAnimEvent( AnimEvent_t& event ) { switch( event.event ) { case SCRIPT_EVENT_SENTENCE_RND1: // Play a named sentence group 25% of the time if (RANDOM_LONG(0,99) < 75) break; // fall through... case SCRIPT_EVENT_SENTENCE: // Play a named sentence group ShutUpFriends(); PlaySentence( event.options, RANDOM_FLOAT(2.8, 3.4), VOL_NORM, ATTN_IDLE ); //ALERT(at_console, "script event speak\n"); break; default: CBaseMonster::HandleAnimEvent( event ); break; } }
//========================================================= // HandleAnimEvent - catches the NPC-specific messages // that occur when tagged animation frames are played. //========================================================= void CNPCSimpleTalker::HandleAnimEvent( animevent_t *pEvent ) { switch( pEvent->event ) { case SCRIPT_EVENT_SENTENCE_RND1: // Play a named sentence group 25% of the time if (random->RandomInt(0,99) < 75) break; // fall through... case SCRIPT_EVENT_SENTENCE: // Play a named sentence group ShutUpFriends(); PlaySentence( pEvent->options, random->RandomFloat(2.8, 3.4) ); //Msg( "script event speak\n"); break; default: BaseClass::HandleAnimEvent( pEvent ); break; } }