Concept

From Valve Developer Community
Revision as of 19:26, 7 August 2005 by N-neko (talk | contribs) (split from response system page with added coding info)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Stub

This article or section is a stub. You can help by expanding it.

Concept is high level state that the code is trying to convey, such as say hello(TLK_HELLO), answer some question(TLK_ANSWER), or call for help(TLK_HELP_ME), etc.


You can command a NPC to speak based on a concept by using Speak( AIConcept_t concept, const char *modifiers /*= NULL*/ ) method. This is defined in AI_Speech.cpp.


bool CAI_Expresser::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/ )
{
	AI_Response *result = SpeakFindResponse( concept, modifiers );
	if ( !result )
	{
		return false;
	}

	SpeechMsg( GetOuter(), "%s (%x) spoke %s (%f)\n", STRING(GetOuter()->GetEntityName()), GetOuter(), concept, gpGlobals->curtime );

	bool spoke = SpeakDispatchResponse( concept, result );
	return spoke;
}


It trys to find a response for the concept from Response System scripts. Then if it finds one, trys to dispatch it.


NPC_talker.cpp is a good example integrating concept speaks within tasks and schedules. If you want to make a custom NPC that talks, this would be the best place to start.


You can also make a NPC choose a response via "DispatchResponse" entity input.


Concept List

ai_behavior_lead.h

ai_behavior_lead.h

TLK_LEAD_START

TLK_LEAD_ARRIVAL

TLK_LEAD_SUCCESS

lead_fail

TLK_LEAD_COMINGBACK

TLK_LEAD_CATCHUP

TLK_LEAD_RETRIEVE

TLK_LEAD_ATTRACTPLAYER

TLK_LEAD_WAITOVER

TLK_LEAD_MISSING_WEAPON

ai_playerally.h

TLK_ANSWER

TLK_QUESTION

TLK_IDLE

TLK_STARE

TLK_USE

TLK_STARTFOLLOW

TLK_STOPFOLLOW

TLK_JOINPLAYER

TLK_STOP

TLK_NOSHOOT

TLK_HELLO

TLK_PHELLO

TLK_PIDLE

TLK_PQUESTION

TLK_PLHURT1

TLK_PLHURT2

TLK_PLHURT3

TLK_PLPUSH

TLK_PLRELOAD

TLK_SMELL

TLK_SHOT

TLK_WOUND

TLK_MORTAL

TLK_DANGER

TLK_SEE_COMBINE

TLK_ENEMY_DEAD

TLK_SELECTED // selected by player in command mode.

TLK_COMMANDED // received orders from player in command mode

TLK_COMMAND_FAILED

TLK_BETRAYED // player killed an ally in front of me.

TLK_ALLY_KILLED // witnessed an ally die some other way.

TLK_ATTACKING // about to fire my weapon at a target

TLK_HEAL // healing someone

TLK_GIVEAMMO // giving ammo to someone

TLK_DEATH // Death rattle

TLK_HELP_ME // call out to the player for help

TLK_PLYR_PHYSATK // Player's attacked me with a thrown physics object

TLK_ANSWER_VORT

TLK_ANSWER_CIT

TLK_QUESTION_VORT

TLK_QUESTION_CIT

TLK_NEWWEAPON

TLK_PLDEAD

TLK_HIDEANDRELOAD

TLK_STARTCOMBAT

TLK_WATCHOUT


TLK_RESUME // resume is as I was saying... or anyhow...


TLK_TGSTAYPUT// tourguide stuff

TLK_TGFIND

TLK_TGSEEK

TLK_TGLOSTYOU

TLK_TGCATCHUP

TLK_TGENDTOUR