Context: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (placeholder, need works)
 
No edit summary
Line 2: Line 2:
{{stub}}
{{stub}}
Map placed entities have up to three "context" keypairs that can be specified. They take the form:   
Map placed entities have up to three "context" keypairs that can be specified. They take the form:   
"key:value" (key, single colon separator, value)
<pre>"key:value" (key, single colon separator, value)</pre>


When an entity with any such context keypairs is asked to dispatch a response, the keypairs are added to the criteria set passed to the rule system.  Thus, map placed entities and triggers can specify their own context keypairs and these can be hooked up to response rules to do map-specific and appropriate responses


*World
When an entity with any such context keypairs is asked to dispatch a [[Responses|response]], the keypairs are added to the [[Criteria]] set passed to the [[Rules||rule]] system.  Thus, map placed entities and triggers can specify their own context keypairs and these can be hooked up to response rules to do map-specific and appropriate responses.
 
 
For example, there is a npc_citizen with ResponseContext keyvalue is "customs_queue:1" in sdk_d1_trainstation_01.vmf.
 
 
This context will match the following criterion from <code>script/talker/npc_citizen_terminal.txt</code>:
 
<pre>criterion "IsTerminalCustomsQueue" "customs_queue" "1" required</pre>
 
And then accorging to this rule, response CitizenCustomsQueue would be chosen.
 
<pre>
rule CitizenCustomsQueue
{
criteria IsCitizen ConceptTalkUse IsTerminalCustomsQueue NPCIdle
response CitizenCustomsQueue
}
</pre>
 
 
==Related Entities==
*[[Worldspawn]]
*NPC
*NPC
**Property
**KeyValue:
***ResponseContext(string) : "Response Contexts" : "" : "Response system context(s) for this entity. Format should be: 'key:value,key2:value2,etc'. When this entity speaks, the list of keys & values will be passed to the response rules system."
***ResponseContext(string) : "Response Contexts" : "" : "Response system context(s) for this entity. Format should be: 'key:value,key2:value2,etc'. When this entity speaks, the list of keys & values will be passed to the response rules system."
**Input
**Input
Line 14: Line 35:
***RemoveContext(string) : "Remove a context from this entity's list of response contexts. The name should match the 'key' of a previously added context."
***RemoveContext(string) : "Remove a context from this entity's list of response contexts. The name should match the 'key' of a previously added context."
***ClearContext(void) : "Removes all contexts in this entity's list of response contexts."
***ClearContext(void) : "Removes all contexts in this entity's list of response contexts."
*env_speaker
*env_speaker(this can have a script file containing rules for playing appropriate sounds.)
*ai_speechfilter
*[[Ai speechfilter|ai_speechfilter]]

Revision as of 21:29, 7 August 2005

Stub

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

Map placed entities have up to three "context" keypairs that can be specified. They take the form:

"key:value" (key, single colon separator, value)


When an entity with any such context keypairs is asked to dispatch a response, the keypairs are added to the Criteria set passed to the |rule system. Thus, map placed entities and triggers can specify their own context keypairs and these can be hooked up to response rules to do map-specific and appropriate responses.


For example, there is a npc_citizen with ResponseContext keyvalue is "customs_queue:1" in sdk_d1_trainstation_01.vmf.


This context will match the following criterion from script/talker/npc_citizen_terminal.txt:

criterion "IsTerminalCustomsQueue" "customs_queue" "1" required

And then accorging to this rule, response CitizenCustomsQueue would be chosen.

rule CitizenCustomsQueue
{
	criteria		IsCitizen ConceptTalkUse IsTerminalCustomsQueue NPCIdle
	response		CitizenCustomsQueue
}


Related Entities

  • Worldspawn
  • NPC
    • KeyValue:
      • ResponseContext(string) : "Response Contexts" : "" : "Response system context(s) for this entity. Format should be: 'key:value,key2:value2,etc'. When this entity speaks, the list of keys & values will be passed to the response rules system."
    • Input
      • AddContext(string) : "Adds a context to this entity's list of response contexts. The format should be 'key:value'."
      • RemoveContext(string) : "Remove a context from this entity's list of response contexts. The name should match the 'key' of a previously added context."
      • ClearContext(void) : "Removes all contexts in this entity's list of response contexts."
  • env_speaker(this can have a script file containing rules for playing appropriate sounds.)
  • ai_speechfilter