Moderator elections are being held. See Valve Developer Community:Moderator elections for more details.
Users who would like to run for moderator must be autoconfirmed and have at least 100 edits. Users can check their own edit count at Special:Preferences.

L4D2 Level Design/Wandering Witch/zh

From Valve Developer Community
Jump to: navigation, search

本简体中文页面由大康翻译于2021年9月11日。


在求生之路2中,我们发现 Witch 只在晚上坐着摇晃自己。如果有阳光,它们就会四处游荡。你可以通过 Map > Map properties… 菜单项在地图中控制此设置。

如果你将 Time of day 更改为一天中太阳出现的任何时间,包括“Dawn”(黎明)、“Morning”(上午)和“Afternoon”(下午),由导演生成的 Witch 会四处游荡。

float

在运行时改变行走方式

如果你想同时拥有站立和坐着的 Witch ,或者随机选择使用哪个,你可以使用脚本来实现。

创建一个名为 Witch_behaviour.nut(或任何有意义的名称)的文本文件,并将其放入 scripts/vscripts 文件夹。
该脚本应包含以下内容:

 function WitchWalk(){
 worldspawn_timeofday <- [
   "3"
 ]
 
 	worldspawn <- Entities.FindByClassname (null, "worldspawn");
 	local i = RandomInt(0,worldspawn_timeofday.len()-1);
 	worldspawn.__KeyValueFromString("timeofday",worldspawn_timeofday[i]);
 }
 
 function WitchSit(){
 worldspawn_timeofday <- [
   "0"
 ]
 
 	worldspawn <- Entities.FindByClassname (null, "worldspawn");
 	local i = RandomInt(0,worldspawn_timeofday.len()-1); 
 	worldspawn.__KeyValueFromString("timeofday",worldspawn_timeofday[i]);
 }
Note.png注意:此脚本基于此脚本示例,但合并为一个脚本并更改了函数名称以使其更有意义。

接下来,将一个 logic_script 实体放入你的地图中,并在“Entity Scripts”字段中输入“Witch_behaviour”。

任何能够触发输出的实体,例如 logic_timertrigger_oncefunc_buttonlogic_case 等可以使用以下输出来改变下一个生成的 Witch 的行为,直到再次改变:

坐着的 Witch

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png 输出条件取决于实体 <logic_script 实体名称> RunScriptCode WitchSit() 0.00 No

游荡的 Witch

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png 输出条件取决于实体 <logic_script 实体名称> RunScriptCode WitchWalk() 0.00 No
Note.png注意:这不会使流浪 Witch 坐下,反之亦然。

你还可以使用 logic_case 在 Witch 行走行为之间随机选择并一个接一个地生成它们,并进行复杂的设置,你就有了诸如糖厂(c4m2)之类的地图,但同时包含坐着和游荡的 Witch。