Left 4 Dead 2/Scripting/Script Functions/rr ProcessRules: Difference between revisions
< Left 4 Dead 2 | Scripting | Script Functions
Jump to navigation
Jump to search
ChimiChamo (talk | contribs) (Edited the script to demonstrate how you can have other survivor concepts play after using a custom one.) |
m (Nescius moved page Left 4 Dead 2/Script Functions/rr ProcessRules to Left 4 Dead 2/Scripting/Script Functions/rr ProcessRules: same as tf2) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 32: | Line 32: | ||
// Create a new concept for Nick to say "Close the door!" as well as another different concept for Coach. This can then be used with the SpeakResponseConcept input for custom maps and scripts. The included scripts are required if you wish to make a followup function, otherwise they are unnecessary. | // Create a new concept for Nick to say "Close the door!" as well as another different concept for Coach. This can then be used with the SpeakResponseConcept input for custom maps and scripts. The included scripts are required if you wish to make a followup function, otherwise they are unnecessary. | ||
IncludeScript("response_testbed", null) | IncludeScript("response_testbed", null) | ||
Line 77: | Line 76: | ||
responses = | responses = | ||
[ | [ | ||
{ scenename = "scenes/Gambler/ScreamWhilePounced01.vcd", | { scenename = "scenes/Gambler/ScreamWhilePounced01.vcd", followup = RThen( "mechanic", "PlayerLaugh", {additionalcontext="null"}, 0.1 ) } //This makes Ellis play the PlayerLaugh response 0.1 seconds after Nick's scene finishes. | ||
], | ], | ||
group_params = g_rr.RGroupParams({ permitrepeats = true, sequential = false, norepeat = false }) | group_params = g_rr.RGroupParams({ permitrepeats = true, sequential = false, norepeat = false }) |
Latest revision as of 14:02, 15 September 2024
Function Description
void rr_ProcessRules(handle rulesArray)
Processes the rulesArray table/array to a concept that is then added to the Response System. Will override any existing concepts.
This is an incomplete implementation of custom talker concepts for VScript, but it is mostly functional.
These concepts will last until the next map load or change.
This can be an effective system for scripts to utilize, allowing you to create concepts for both custom and vanilla campaigns while having minimal conflicts with other talker files.
Beware though, some values like predelay may not be implemented.
Parameters
Type | Name | Description |
---|---|---|
handle | rulesArray | The table/array to use for creating/overriding talker concepts. |
Example
// Create a new concept for Nick to say "Close the door!" as well as another different concept for Coach. This can then be used with the SpeakResponseConcept input for custom maps and scripts. The included scripts are required if you wish to make a followup function, otherwise they are unnecessary.
IncludeScript("response_testbed", null)
local newrules =
[
{
name = "TestCustomConceptGambler", // The name of the concept. This will override any other concept with the same name
criteria = // Criteria
[
[ "concept", "CustomConcept" ], // Required. The name to be used by SpeakResponseConcept and other parts of the game
[ "who", "Gambler" ] // Survivor name. Acts like IsGambler
],
responses =
[
{ scenename = "scenes/Gambler/CloseTheDoor01.vcd", },
{ scenename = "scenes/Gambler/CloseTheDoor02.vcd", }
],
group_params = g_rr.RGroupParams({ permitrepeats = true, sequential = false, norepeat = false })
},
// Multiple tables can be fit into one array to process more than one concept with just one table!
{
name = "CoachWantsPancakesButGetsClownsInstead",
criteria =
[
[ "concept", "CoachPancakeTalk" ],
[ "who", "Coach" ]
],
responses =
[
{ scenename = "scenes/Coach/EllisInterrupt09.vcd", }, // I'm listening, but this better be about pancakes!
{ scenename = "scenes/Coach/ReactionNegative02.vcd", }, // What the-
{ scenename = "scenes/Coach/SeeClowns01.vcd", } // CLOWNS?!
],
group_params = g_rr.RGroupParams({ permitrepeats = false, sequential = true, norepeat = false })
},
// This demonstrates the "followup" function to allow for chained responses.
{
name = "FollowupDemonstration",
criteria =
[
[ "concept", "NickPouncedButEllisDontCare" ],
[ "who", "Gambler" ]
],
responses =
[
{ scenename = "scenes/Gambler/ScreamWhilePounced01.vcd", followup = RThen( "mechanic", "PlayerLaugh", {additionalcontext="null"}, 0.1 ) } //This makes Ellis play the PlayerLaugh response 0.1 seconds after Nick's scene finishes.
],
group_params = g_rr.RGroupParams({ permitrepeats = true, sequential = false, norepeat = false })
},
]
// Add the concept
g_rr.rr_ProcessRules( newrules );