Response System: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
Line 1: Line 1:
{{stub}}
{{stub}}
==Introduction==
==Introduction==
In HL2, AIs speak based on [[Concepts]].  
Response System controls what a NPC talks on a certain situation. e.g. It makes Alyx say "Excuse me" when the player pushes her, Citizens greet when they see the player, Vortigaunts tell stories on USE button, etc.


<code>/scripts/talker/response_rules.txt</code> is the base script file for the global Response System that controls Expressive NPCs.


<code>/scripts/talker/response_rules.txt</code> is the base script file for this Response System. It contains [[Criteria|criterion]]/[[Rules|rule]]/[[Responses|response]] definitions. This controls interactive NPC talks in game. e.g. It makes Alyx say "Excuse me," Citizens greet, Vortigaunts tell stories, etc.
Also an [[env_speaker]] entity can specify its own Context rule script. See <code>scripts/talker/terminal_pa.txt</code> for terminal announcement example.


 
These scripts contain [[Criteria|criterion]]/[[Rules|rule]]/[[Responses|response]] definitions. The Response system checks each rule against the set, give it a numeric score based on the rule's set of criteria. Then the system picks one rule with the highest score, dispatch a response that the rule points.  
The Response system checks each rule against the set, give it a numeric score based on the rule's set of criteria. Then the system picks one rule with the highest score, dispatch a response that the rule points.


*[[Concepts]]
*[[Concepts]]
Line 15: Line 15:
*[[Rules]]
*[[Rules]]
*[[Reponses]]
*[[Reponses]]


==Add your new custom NPC to the Response System==
==Add your new custom NPC to the Response System==

Revision as of 08:54, 14 August 2005

Stub

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

Introduction

Response System controls what a NPC talks on a certain situation. e.g. It makes Alyx say "Excuse me" when the player pushes her, Citizens greet when they see the player, Vortigaunts tell stories on USE button, etc.

/scripts/talker/response_rules.txt is the base script file for the global Response System that controls Expressive NPCs.

Also an env_speaker entity can specify its own Context rule script. See scripts/talker/terminal_pa.txt for terminal announcement example.

These scripts contain criterion/rule/response definitions. The Response system checks each rule against the set, give it a numeric score based on the rule's set of criteria. Then the system picks one rule with the highest score, dispatch a response that the rule points.

Add your new custom NPC to the Response System

  • Make your NPC derived from NPC_talker
  • Write a new rule script for your NPC
    • See npc_xxx.txt for examples
  • Include the new script in /scripts/talker/response_rules.txt