Logic director query: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(21 intermediate revisions by 8 users not shown)
Line 1: Line 1:
== logic_director_query ==
{{LanguageBar}}
__NOTOC__
{{CD|CLogicDirectorQuery}}
{{this is a|logical entity|name=logic_director_query|game=Left 4 Dead 2}} It is used to output the [[info_director|AI Director]]'s 'anger' value, where the director is angered by players that are performing well. This provides an opportunity for map elements to be adjusted in an attempt to appease the AI Director. Some examples include adjusting the goal distance and increasing/decreasing obscuring weather effects.


Any number of logic_director_query entities can exist in the same map, each with their own value range and noise settings.


This entity is used in Left 4 Dead 2 to create a reference to the AI Director's 'Anger' value and create different outputs for different values. Basically the whole point of this entity is to create a range of numbers to judge the anger level of the director.
==KeyValues==
{{KV Targetname}}
{{KV|Min Anger Range|intn=minAngerRange|int}}
{{KV|Max Anger Range|intn=maxAngerRange|int|The range of integers used to represent the director's anger. The value will be mapped within it. Choosing a wider range of numbers allows finer "anger management".}}
{{KV|Noise|intn=noise|choices|Randomises the entity's output slightly. “No noise” will cause the output being the exact remapped value of the director's anger, while “complete noise” will result in a random number within the anger range. There are various other levels in between.}}


==Inputs==
{{I|HowAngry|Asks the director: “On a scale of <Min Anger Range> to <Max Anger Range>, how angry are you?”}}


==Outputs==
{{O|OutAnger|Director is this much angry (expressed as an integer), fired in response to <code>HowAngry</code>. Sends the current remapped value of the director's anger to an entity of your choice ([[logic_case]] is generally the most useful).|param=int}}
{{O|On20SecondsToMob|Fires 20 seconds before a mob is spawned.}}
{{O|On60SecondsToMob|Fires 60 seconds before a mob is spawned.}}


'''Usage:'''
== See also ==
 
* [[L4D2 Level Design/Director Queries]]
'''Keyvalues:'''
 
''Name'' – required to reference this entity from another entity.
 
''Min/Max Anger Range'' –  A range of integers that will be used to represent the director's anger. The director's anger level does not change when altering this, but is calculated into whatever range of values you placed here. This allows the use of multiple logic_director_queries on one map that each have their own ranges and noise settings. These numbers are what is actually sent to other entities.
 
''Noise'' – Lets you change the way the director's anger value is calculated. “No noise” will result in the output of the exact remapped value of the director's anger, while “complete noise” will pick a random number in the range, with various levels between.
 
 
 
'''Input:'''
 
''HowAngry'' –  The primary input used to trigger dynamic changes of layout or events. Creating a HowAngry input from another entity or brush basically asks the director: “On a scale from 1 to X, how angry are you?”
 
Other Inputs:
 
''AddOutput''
''FireUser1-4''
''Kill/KillHierarchy''
 
 
'''Output:'''
 
''OutAnger'' – The primary Output used to dynamic changes of layout or events. OutAnger will send the current number value of the director's anger to an entity of your choice (logic_case appears to be most useful).
On20SecondsToMob – (Note- I've not experimented with this one much yet) This Output seems to do exactly what it's name suggests, triggering an event 20 seconds before the director's anger forces it to spawn a mob.
 
Other Outputs:
 
''OnKilled''
''OnUser1-4''
 
 
 
 
'''Examples:'''
 
The logic_director_query can be used both as a dynamic reference to the AI Director's anger and as semi-random number generator.
 
''To use the entity to reference the AI director's anger level:''
Set up the events you want to use the entity to trigger, create the logic_director_query and whatever method you want to use to trigger it. Name the logic_director_query something you'll remember (directorAnger01 or whatever), then set its Min/Max Anger Range to 1 (or the lowest value you want it to output) and X (being the highest value you want the entity to output).
 
Select your triggering entity/brush and create an output pointing to the logic_director_query using HowAngry (such as OnTrigger – directorAnger01 – HowAngry).
 
Create a logic_case entity and name it something relevant or something you'll remember (ex. barricadePicker). Set the cases to do whatever it is you want them to do, keeping in mind that any case over CaseX (X being Max Anger Range) won't be called. Now go to your logic_director_query and create an output pointing at the logic_case entity that reads OutAnger – (logic_case) – InValue . This will send the value of the director's anger to the logic_case entity to execute the corresponding case number.
 
 
Playing around with the Noise setting will allow the output to less predictable, and combining this with multiple case statements will allow for a large amount of dynamic events.

Latest revision as of 04:53, 29 April 2025

English (en)中文 (zh)Translate (Translate)
C++ Class hierarchy
CLogicDirectorQuery
CPointEntity
CBaseEntity

logic_director_query is a logical entity available in Left 4 Dead 2 Left 4 Dead 2. It is used to output the AI Director's 'anger' value, where the director is angered by players that are performing well. This provides an opportunity for map elements to be adjusted in an attempt to appease the AI Director. Some examples include adjusting the goal distance and increasing/decreasing obscuring weather effects.

Any number of logic_director_query entities can exist in the same map, each with their own value range and noise settings.

KeyValues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Min Anger Range (minAngerRange) <integer>
Max Anger Range (maxAngerRange) <integer>
The range of integers used to represent the director's anger. The value will be mapped within it. Choosing a wider range of numbers allows finer "anger management".
Noise (noise) <choices>
Randomises the entity's output slightly. “No noise” will cause the output being the exact remapped value of the director's anger, while “complete noise” will result in a random number within the anger range. There are various other levels in between.

Inputs

HowAngry
Asks the director: “On a scale of <Min Anger Range> to <Max Anger Range>, how angry are you?”

Outputs

OutAnger <integerRedirectOutput/integer>
Director is this much angry (expressed as an integer), fired in response to HowAngry. Sends the current remapped value of the director's anger to an entity of your choice (logic_case is generally the most useful).
On20SecondsToMob
Fires 20 seconds before a mob is spawned.
On60SecondsToMob
Fires 60 seconds before a mob is spawned.

See also