Difference between revisions of "求生之路2脚本"

From Valve Developer Community
Jump to: navigation, search
(Redirected page to L4D2 Vscripts:zh-cn)
(Tag: New redirect)
m (Removed redirect to L4D2 Vscripts:zh-cn)
(Tag: Removed redirect)
 
Line 1: Line 1:
#REDIRECT [[L4D2_Vscripts:zh-cn]]
+
<noinclude>{{Delete|Useless.}}</noinclude>
{{toc-right}}
 
{{sq}}{{l4d2}} '''Left 4 Dead 2 [[VScript|脚本]]'''是运行在服务器端的虚拟机。 它们用一种类似于[http://www.lua.org/ Lua] 的编译脚本语言 [[Squirrel]]写的。
 
 
 
 
 
== Uses ==
 
 
 
=== [[L4D2_Director_Scripts|导演实体脚本]] ===
 
[[VScript|脚本]]用在求生之路2里最常见的就是[https://developer.valvesoftware.com/wiki/L4D2_Director_Scripts]。 这些脚本能从infected spawning到[[L4D2_Level_Design/Boss_Prohibition|prohibiting boss infected]]的小范围调整, 自定义一些比如onslaughts和gauntlets, 甚至复杂的恐慌事件和完全自定义的[[L4D2_Level_Design/Custom_Finale|custom finales]]。官方宣传活动中的大部分都是以这种方式实现的。
 
 
 
Director脚本主要通过将Director所使用的各个变量的值覆盖到<code>DirectorOptions</code>表中来工作。
 
 
 
导演实体脚本一次只能运行一个。而且执行一个新的将会终止任何先前运行的一个,并删除它在<code>DirectorOptions</code>中设置的任何值。
 
 
 
=== [[#Entity Scripts 3|实体脚本]] ===
 
实体脚本也是另一种常用的脚本,主要给实体附上脚本。该实体脚本能让我们轻松访问和修改实体的属性, 甚至添加一个新的[[KeyValues|键值]]。这允许以对于Hammer中的实体I / O系统非常复杂或不可能的方式来控制实体。
 
 
 
任何实体都能够运行脚本,并且能够将指定的''think''函数设置为每0.1秒运行一次,以及将脚本代码作为实体输出执行。
 
 
 
一些实体还具有专用于VScript的功能,其中最突出的是[[point_script_use_target]],允许将其他实体转换为完全可编程的定时按钮。
 
 
 
=== [[#Global Scripts 3|Global Scripts]] ===
 
Scripts can also be made to run on map load, based on game mode and optionally map name. These scripts are commonly used to create scripting and modify global Director options for [[Mutation_Gametype_(L4D2)|mutations]], but can also be used in custom maps.
 
 
 
Global scripts can have [[List_of_L4D2_Script_Functions#Scripted_Mode_hooks|script hook functions]] added that get called from the game at certain events, like when players/objects take damage.
 
 
 
There are many utility functions and features readily available for these scripts, including a resource and building system, and custom panic wave spawning. Please see Valve's [[L4D2_EMS|Expanded Mutation System tutorial]] for more information.
 
 
 
=== Other uses ===
 
All scripts can access functions for many features, including [[L4D2_EMS/Appendix:_Spawning|spawning entities]] either from precompiled lists or programmatically, [[L4D2_EMS/Appendix:_Spawning_Infected|spawning infected]], a [[L4D2_EMS/Appendix:_HUD|HUD system]], [[L4D2_EMS/Appendix:_Table_Save_Restore|storing data]] across levels and to disk, and much more.
 
 
 
Please see [[L4D2 Vscript Examples]] for more examples and ideas.
 

Latest revision as of 11:04, 14 February 2023

Warning icon.png
This article has been marked as a candidate for speedy deletion for the following reason:
Useless.
If you object to this decision, then please discuss why hereIf this page doesn't meet the criteria for speedy deletion, then please remove this notice, but do not remove it from pages that you have created yourself
Administrators - Remember to check if anything links here and the page history (last edit) before deleting.