L4D2 Level Design/Wandering Witch: Difference between revisions
ThaiGrocer (talk | contribs) mNo edit summary |
(undone multipage) |
||
(16 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{LanguageBar}} | |||
{{L4D2 level intro menu}} | {{L4D2 level intro menu}} | ||
Line 5: | Line 7: | ||
If you change '''Time of day''' to any time of day when the sun is out, including "<code>Dawn</code>", "<code>Morning</code>", and "<code>Afternoon</code>", witches spawned by the Director will wander. | If you change '''Time of day''' to any time of day when the sun is out, including "<code>Dawn</code>", "<code>Morning</code>", and "<code>Afternoon</code>", witches spawned by the Director will wander. | ||
[[ | [[File:L4D2_witchwander_timeofday.png|float|center]] | ||
==Changing Behaviour at runtime== | |||
If you would like to have both standing and sitting witches, or randomly pick which to use, you can do so by using a vscript. | |||
Create a text file called '''Witch_behaviour.nut''' (or any sensical name) and put it into the scripts/vscripts folder.<br> | |||
The script should contain the following: | |||
<source lang=lua>//This script basically just swaps a Cvar specifically bound to witch behaviour. | |||
function WitchWalk(){ | |||
Convars.SetValue("sv_force_time_of_day",3) | |||
} | |||
function WitchSit(){ | |||
Convars.SetValue("sv_force_time_of_day",0) | |||
}</source> | |||
Next, place a [[logic_script]] entity into your map, using "Witch_behaviour" in the "Entity Scripts" field. | |||
Any entity capable of firing [[Inputs and Outputs|outputs]], such as [[logic_timer]], [[trigger_once]], [[func_button]], [[logic_case]], ect. can have the following output to change the behaviour of the next spawned witches until changed:<br> | |||
'''Sitting Witch''' | |||
{| {{OutputsTable}} | |||
| [[File:Io11.png]] || ''Depends on entity'' || <logic_script entity name> || RunScriptCode|| WitchSit() || 0.00 || No | |||
|} | |||
'''Wandering Witch''' | |||
{| {{OutputsTable}} | |||
| [[File:Io11.png]] || ''Depends on entity'' || <logic_script entity name> || RunScriptCode|| WitchWalk() || 0.00 || No | |||
|} | |||
{{note|This will not make a witch stand up or sit down after she has spawned.}} | |||
You could also make an intricate setup of a [[logic_case]] randomly picking between witch behaviours and spawns them one after another, to get a map such as the Sugarmill, but with both sitting and wandering witches. | |||
{{NavBar|L4D2 Level Design/Scavenge Maps |L4D2 Level Design|L4D2 Level Design/Instructor Hints}} | {{NavBar|L4D2 Level Design/Scavenge Maps |L4D2 Level Design|L4D2 Level Design/Instructor Hints}} | ||
[[Category:Left 4 Dead 2]] | [[Category:Left 4 Dead 2]] |
Latest revision as of 06:33, 13 July 2024
In L4D2, we discover that witches sit and rock themselves only at night. If there's sunlight, they wander. You can control this in your map from the Map > Map Properties... menu item.
If you change Time of day to any time of day when the sun is out, including "Dawn
", "Morning
", and "Afternoon
", witches spawned by the Director will wander.
Changing Behaviour at runtime
If you would like to have both standing and sitting witches, or randomly pick which to use, you can do so by using a vscript.
Create a text file called Witch_behaviour.nut (or any sensical name) and put it into the scripts/vscripts folder.
The script should contain the following:
//This script basically just swaps a Cvar specifically bound to witch behaviour.
function WitchWalk(){
Convars.SetValue("sv_force_time_of_day",3)
}
function WitchSit(){
Convars.SetValue("sv_force_time_of_day",0)
}
Next, place a logic_script entity into your map, using "Witch_behaviour" in the "Entity Scripts" field.
Any entity capable of firing outputs, such as logic_timer, trigger_once, func_button, logic_case, ect. can have the following output to change the behaviour of the next spawned witches until changed:
Sitting Witch
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
Depends on entity | <logic_script entity name> | RunScriptCode | WitchSit() | 0.00 | No |
Wandering Witch
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
Depends on entity | <logic_script entity name> | RunScriptCode | WitchWalk() | 0.00 | No |

You could also make an intricate setup of a logic_case randomly picking between witch behaviours and spawns them one after another, to get a map such as the Sugarmill, but with both sitting and wandering witches.