Left 4 Dead 2

Left 4 Dead 2

63 ratings
Talker Scripts: General and Addon guide!
By Xanaguy
This guide will explain the ways of how Talker scripts work and how you can string together the conversations you want.

As an added bonus: I will also explain how you can make any custom campaign compatible with your talker scripts.

I do apologize if any information here has already been mentioned at an earlier point in the guide. I typically do not make guides so thorough.

Another, well-constructed presentation can be found here: https://www.youtube.com/watch?v=tAbBID3N64A
3
   
Award
Favorite
Favorited
Unfavorite
Survivors' Talker Scripts (Part 1)
Talker Scripts typically contain the following:





Response PlayerWorldC3M1FerryCrossingG01Coach

The name of the response table. This is needed at the end of the rule for the response table to be used.

{ scene "scenes/Coach/WorldC3M116.vcd" then any WorldC3M1FerryCrossingG02 foo:0 -4.832 //Though I walk through the valley of the shadow of death, I will fear no evil scene "scenes/Coach/WorldC3M117.vcd" then any WorldC3M1FerryCrossingG02 foo:0 -6.085 //Though I walk through the valley of the shadow of death, I will fear no evil }

The scenes used in the particular response table. Many things can be added here along with a particular scene to generate unique responses and even other features of the talker.

Having scenes in this table isn't enough. To string a conversation together, you would need to target an entity to speak the next concept. The valid entities are the following:

then _

- Coach (Coach)
- Gambler (Nick)
- Mechanic (Ellis)
- Producer (Rochelle)
- Biker (Francis)
- Manager (Louis)
- NamVet (Bill)
- TeenGirl (Zoey)
- Any (Any survivor that has a rule/response with the matching concept criteria)
- All (All survivors that had a rule/response with the matching concept criteria)
- Self (The same survivor who is speaking the current response)
- From (The survivor who spoke the previous response in a conversation. For example... If Bill speaks first, and the prompt forces Francis to speak next with From as the next speaker, then from will be Bill who has to speak next if the rule has the appropriate concept)
- Any func_orator entity's targetname (orator, orator_chopper, churchguy, etc)

WorldC3M1FerryCrossingG02

The concept name you would like to use in your follow-up talker rule. They are one of the two key things that are always a requirement for the response to work. Concepts can be triggered either by the talker script as shown in this example, or they can be fired via entity I/O which will be explained later along with defining the concept in the main talker script.


foo:0

The context that you would like to apply to the specific entity that fires the specific response. This is almost never used because there is another way that one can apply contexts in the same manner when the talker rule is invoked.

-6.085

Last thing: Is a timer of when you want the next response for the scene to fire. This can be set as a negative or a positive number.

If the timer is negative, then the response will happen X seconds after the rule is invoked (this includes if the scene is equipped with any pre-delays.

If the timer is positive, then the next response will happen X seconds after that particular scene finishes. Timing is everything when you want a conversation to feel natural.
Survivors' Talker Scripts (Part 2)
Now that the response table has been set up to your liking, you will need a rule table to set the exact conditions needed for your response to fire.

To get the most information, a different rule will be used as an example.





Rule PlayerRemarkC1M3ThisWayMechanic

The name of the rule. It is important to use unique names for every rule to avoid the talker from accidentally issuing the wrong response.


criteria ConceptRemark IsMechanic IsC1M3ThisWay IsNotSaidC1M3ThisWay IsNotCoughing NotInCombat IsTalk IsTalkMechanic IsWorldTalkMechanic IsSubjectNear300 AutoIsNotScavenge AutoIsNotSurvival IsNotSpeakingWeight0

The list of criterion that is needed for the response to fire. *ALL CRITERIA HAS TO BE MET* If even a single one fails, then the response won't fire.

This is the key thing to make a response activate under the context you want. There are plenty of contextual criterions that one can use (But not all may be compatible).

The absolute two criteria types that you need in a rule at all times are "Concept" and "Who".

- Concept is typically what is needed via entity i/o or talker script prompts to fire the next response.
- Who is who the survivor that is speaking is.

More detailed explanations will be given in the Criterion section.

ApplyContext "SaidC1M3ThisWay:1:0" applycontexttoworld

You can optionally apply any amount of contexts here. Some rules may require that a specific context is applied so that the rule will not fire again.

You can separate contexts with a comma between each one.

The context name and the additional values have to be separated by colons.

Typically, they consist of the following:

- The name of the context you wish to apply
- The value of the context name
- The timer (in seconds) to make a context last a certain time. (0 is indefinite)

You can also apply a contextual value as a counter instead of applying a certain value. Instead of the context value and timer, you can simply apply the counter value as follows:

++X
(X meaning the value).

This particular method does not require a timer and is thus applied indefinitely.

Notably, you can also choose to apply the context to the world or to the specific entity that fires the response.

To apply it to the world: Add "applycontexttoworld" below the "ApplyContext" line.

To apply it to the speaking entity: Do not add "applycontexttoworld"

Response PlayerRemarkC1M3ThisWayMechanic

Lastly, this is the response that the rule executes when the criteria is met and the concept is called for. it selects one scene at random from that response table.
Orator's Talker Script
The Orator's responses/rules are almost identical to how the survivor scripts work. But there are a few key differences that make them stand out. While they can issue scenes, make survivors respond, and apply context, they also:

- Do NOT require the "Who" criteria.
- Often utilize entity I/O to make the activating survivor say something.
Entity Input/Output
Concepts can be fired via an Entity output. There are many valid targets that you can designate along with the proper input designation.

Valid Targets + Compatible parameter(s):

!<survivor name> (Bill, Nick, etc) * + SpeakResponseConcept + <Concept Name>
<func_orator's targetname> + SpeakResponseConcept + <Concept Name>
<info_director's targetname> + FireConceptToAny + <Concept Name>

* !Activator and !Caller are also valid targets when trying to target the specific survivor that activated an input

For the orator speaking a response concept via an entity output, they may also have the WhoDidIt criteria as a way to make the survivor say something with the orator's response rule. This can also allow unique conversations with an NPC actor and the survivor.

It is set up as follows:

<func_orator's targetname> + SpeakResponseConcept + "<Concept name> WhoDidIt:!Activator" **

Edit: I have just found that "!Activator", "!Caller", and "!<Survivor name>" are also valid targets.

** !Caller is also a valid target
Extra Talker Script Response Inputs
There is much more than simply having a scene in a response table and maybe having the speaker use the next prompted concept. You can also allow certain scenes in a response to have extra traits. These go after the quotes containing your desired scene and before "then".

These can often be combined with each other.

Valid Traits:

speakonce
Scenes with this are only used once in a particular response per chapter. (Currently non-functional)

odds X

Scenes in a response table with this have that % chance of playing. This is used to make a particular scene in the same response rarer than others.

predelay "X,X"

Scenes with this will not play until a delay of X seconds has passed. You can designate a minimum and maximum time using two values as the example, or you can use a single value for a non-random delay.

fire <logic_relay targetname> Trigger <timer>

One of my personal favorite functionalities. This will trigger an in-map logic_relay entity with the matching targetname after a set timer (In seconds). Unlike the timer mentioned in the first part of this guide, this timer will only accept a positive value. And it starts once the rule/concept has been invoked.



The Response Table(s) require at least one of three types of inputs. These inputs go before the aforementioned traits and are the main things behind the survivor speaking something.

The inputs are:

scene " "

The quotes for "scene" designate the file path the scene you want to play is located - down to the .vcd, they are typically located in the "left4dead2", "..._dlc1", "..._dlc2", "..._dlc3", and "update" directories.

speak " "

The quotes for "speak" designate the sound you want to have played without using scene files. They can be found in the appropriate soundscript(s). But it is impossible to have anyone respond to it using "then _"

print " "

The quotes for "print" typically designates what gets printed in the console for debugging purposes. But it serves better as a blank response for all entities. As an added bonus, it also doesn't interrupt the survivor's current scene/speech. So this is ideal for silently applying contexts.)

The response table can also be equipped with two accessory-like traits. They both go at the top lines of the response table.

They are:

norepeat
*
Scenes in a response with this will not repeat. Similar to speakonce, but this is for all scenes. Once all scenes in the response have been used, then they won't be fired in that manner again until the next chapter.

sequential
*
Scenes in a response with this will play in top-to-bottom order. There is still a bug where the order resets to the top scene, but it will only play the top scene.


Notes:

* Sequential and Norepeat can go together.
Criterion
Criterion comes in many types/forms.

There can be criterion that uses a string value such as "concept" and "who":

criterion "ConceptRemark" "Concept" "TLK_REMARK" required

Or even criterion that use numeric values:

Criterion "IsNotSaidAlertGiveItemStop" "SaidAlertGiveItemStop" "!=1" "required" weight 0
**

criterion "IsRunning" "movementspeed" ">=200" required
*

Numerical Values have prefixes that provide more flexibility. These go in the quotes before the actual value of the main criteria type.

>=X
Greater than or equal to X

>X
Greater than X

<=X
Less than or equal to X

<=X
Less than X

!=X
***
Any value other than X

Criterion can also have a weight value next to it. This is essential for making certain rules take priority over others that use the same concept.

The rule with the greatest combined weight value will be the one that fires. Additionally, you can also assign a specific weight value to a certain rule just before the "Response" line and after the applycontext/applycontexttoworld line.

forceweight X

Group Criterions allow two or more criterion (preferably of the same type) to be used in a single rule as an "or" statement.

This is primarily used for Dead Center - Chapter 1 and Chapter 2 for SI callouts.

This Criterion is set up like so:

criterion "C1M1orC1M2" { ismap_c1m1_hotel ismap_c1m2_streets } required weight 100


Notes:

* Certain criteria such as "movementspeed" is tracked individually per survivor.

** Contextual criteria such as this are those that are only applied to the entity that fires the rule/response. Contexts applied to the world will have "world" before its actual name.

*** This is also compatible with string value based criterion, great for "map", etc.
End of Main Guide
Thanks to everyone who took the time to read this guide. If you have any questions, feel free to comment here or on my profile. Or you can contact me on Discord directly at: "Xanaguy#1506"
Addon Campaign Compatibility
It is possible to make any addon campaign compatible with the talker scripts in a way where the talker scripts can be a separate addon as an accessory.

To do this, you would need to change the response issued by all survivor rules that always enable the saferoom intros.

Like this example:

Rule SafeRoomStartBiker { criteria ConceptTalkIdle IsBiker IsInStartArea AutoIsNotScavenge AutoIsNotSurvival _auto_NotSafeRoomStart ApplyContext "Talk:1:45,_auto_SafeRoomStart:1:0,_auto_SafeRoomQuiet:1:5" applycontexttoworld Response CustomTalkerEnable }


Next, you need to create a response table that fires a specific logic_relay entity in the map. In my addon, I use this single response table from the terror_player.txt script:

Response CustomTalkerEnable { print " " fire relay_talker_addon Trigger 0 }

The logic_relay entity itself typically deletes any logic_choreographed_scene entity and ambient_generic entity responsible for survivor voicelines. This essentially paves the way for the talker to act like a replacement/accessory for the custom campaign. Whether it be creating custom intros or using custom concepts (as long as they are defined).

It is highly recommend NOT to equip this logic_relay entity to any in-map input. It is only meant to be triggered by the talker scripts so that talker addons can act as an accessory while it is active.
6 Comments
21 Oct, 2022 @ 9:34pm 
Can you do a Guide, Of how to Laught in Versus with characters??
Shadowysn 30 May, 2021 @ 1:48am 
@Fulcrum_X
What in the hell is foo?
Xanaguy  [author] 7 Dec, 2020 @ 12:23pm 
Added. Thanks!
Xanaguy  [author] 7 Dec, 2020 @ 11:54am 
Oh, i forgot about those. Alright, I’ll add them as soon as I get out of bed.
Fulcrum_X 7 Dec, 2020 @ 8:17am 
Nice! The only thing I didn't completely understand was how to use foo correctly and just put "foo:0 0" in everything.
I also learned a lot from opening and tweaking your mod True Talker DS for my own personal use, hope you don't mind :steamhappy:.
Also worth adding to the guide, using in the response table: speakonce, norepeat and sequential.
Andrey 6 Dec, 2020 @ 7:57pm 
How to make tickrate " 100 " on a local game?