This article relates to the game "Dota 2". Click here for more information.
This article relates to the SDK/Workshop Tools for "Dota 2 Workshop Tools". Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Dota 2 Workshop Tools/Scripting: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(62 intermediate revisions by 31 users not shown)
Line 1: Line 1:
在DOTA2中,使用Lua作为它的脚本语言。Lua脚本将Dota2加载你的addon时被调用,这些脚本可以处理游戏中大部分方面的内容。脚本可以控制发生在游戏中的事件,游戏规则,技能,如何与英雄相互影响,小兵,AI,等等。
{{Dota 2Tools topicons}}
== 脚本入门 ==
{{Lang|title = Scripting}}
* [[Dota 2 Workshop Tools/Scripting/Getting Started|入门]]
[[Category:Dota 2 Workshop Tools]] [[Category:Scripting]]


== 技能脚本 ==
Scripting in Dota 2 is handled by the [[VScript]] virtual machine using the [http://www.lua.org Lua] programming language. Lua will be launched at run time when Dota 2 loads your add-on and can manipulate most facets of the game. Scripts can control the events that happen in game modes, game rules, abilities, hero interactions, neutrals , AI, and many more.
* [[Dota 2 Workshop Tools/Scripting/Abilities Data Driven|数据驱动技能]]
== Getting Started ==
* [[Dota 2 Workshop Tools/Scripting/Abilities Scripted|脚本技能]]
The documentation presented here assumes basic knowledge of Lua.  If you're new to programming and Lua it's worth spending some time at the [http://www.lua.org/ official Lua website] learning some of the basic concepts.  Additional resources are available at the bottom of the page for new users.
* [[Dota 2 Workshop Tools/Scripting/Modifier and Action list|装饰者和动作列表]]


== 常用技术 ==
* [[Dota 2 Workshop Tools/Scripting/Getting Started|Getting Started]]
* [[Dota 2 Workshop Tools/Scripting/Thinkers|思想者(相当于timer)]]
* [[Dota 2 Workshop Tools/Scripting/Debugging Lua scripts|Debugging Lua scripts]]
* [[Dota 2 Workshop Tools/Scripting/Console Commands|控制台命令]]
* [[Dota 2 Workshop Tools/Scripting/Dedicated VConsole Log Viewer|独立VConsole日志视图]]
* [[Dota 2 Workshop Tools/Scripting/Simple Trigger that calls Lua| 调用Lua的简单触发器]]


== 参考资料==
== Scripting Abilities ==
* [[Dota 2 Workshop Tools/Scripting/API|Dota 2脚本API]]
* [[Dota 2 Workshop Tools/Scripting/Abilities Data Driven|Data Driven Abilities]]
* [[Dota 2 Workshop Tools/Scripting/Constants|Dota 2脚本常量]]
* [[Dota 2 Workshop Tools/Scripting/Abilities Data Driven Examples|Data Driven Ability Examples]]
* [[Dota 2 Workshop Tools/Scripting/Built-In Engine Events|引擎内置事件]]
* [[Dota_2_Workshop_Tools/Lua_Abilities_and_Modifiers|Lua Abilities and Modifiers]]
* [[Dota 2 Workshop Tools/Scripting/Built-In Ability Names|引擎内置名称]]
* [[Dota 2 Workshop Tools/Scripting/Built-In Modifier Names|引擎内置技能]]


== Lua资源 ==
== Common Techniques ==
* [http://www.lua.org/ Lua官网]
* [[Entity_Scripts|Entity Scripts]]
* [[Dota 2 Workshop Tools/Scripting/ThinkerFunctions|Thinker Functions]]
* [[Dota 2 Workshop Tools/Scripting/Console Commands|Console Commands]]
* [[Dota 2 Workshop Tools/Scripting/Dedicated VConsole Log Viewer|Dedicated VConsole Log Viewer]]
* [[Dota_2_Workshop_Tools/Scripting/Listening_to_game_events|Listening to Game Events]]
* [[Dota_2_Workshop_Tools/Script_Filters|Script Filters]]
* [[Dota_2_Workshop_Tools/Custom_Game_Events|Custom Game Events]]
* [[Dota_2_Workshop_Tools/Custom_Nettables|Custom Nettables]]


== Reference ==
* [[Dota 2 Workshop Tools/Scripting/API|Scripting API]]
* [[Source_2_Animation_System_VScript_API|Animation System API (deprecated)]]
* [[Dota 2 Workshop Tools/Scripting/Built-In Engine Events|Built-In Engine Events (warning: many broken)]]
* [[Dota 2 Workshop Tools/Scripting/Built-In Ability Names|Built-In Ability Names]]
* [[Dota 2 Workshop Tools/Scripting/Built-In Modifier Names|Built-In Modifier Names]]
* [[Dota 2 Workshop Tools/Scripting/Built-In Item Names|Built-In Item Names]]
* [[Dota 2 Workshop Tools/Scripting/Heroes_internal_names|Heroes Internal Names]]
* [[Dota 2 Workshop Tools/Scripting/Built-In Unit Names|Built-In Unit Names]]
* [[Dota 2 Workshop Tools/Scripting/BoundsHullName Size Reference|BoundsHullName Size Reference]]


== Examples ==
* [[Dota 2 Workshop Tools/Scripting/Simple Trigger that calls Lua| Simple trigger that calls Lua]]
* [[Dota 2 Workshop Tools/Scripting/Abilities Scripted Example| Data driven item that drops upon death]]
* [[Dota 2 Workshop Tools/Scripting/Data Driven Motion Controller Example | Motion Controller Example]]
* [[Dota 2 Workshop Tools/Scripting/Creating a Tower Example | Creating a Tower Example]]
* [[Dota 2 Workshop Tools/Scripting/Detecting If Player Clicked Inside An Area | Detecting If Player Clicked Inside A Given Area When Using Items or Spells]]
* [[Dota 2 Workshop Tools/Scripting/Using Bitfields To Adjust Stat Value Bonuses | Using Bitfields To Adjust Stat Value Bonuses]]
* [[Dota 2 Workshop Tools/Scripting/Using CreateHTTPRequest | Using CreateHTTPRequest]]


{{shortpagetitle}}
== Lua Resources ==
[[Category:Dota 2 Workshop Tools]]
* [http://www.lua.org/ Official Lua Website]
* [http://www.lua.org/pil/ Programming in Lua] - Good resource for learning Lua.  If you're new to Lua or programming this is a good reference point to start from.
* [http://www.lua.org/pil/contents.html Programming In Lua - Online] - First edition of the above book is available online for free.
* [https://github.com/bhargavrpatel/Dota-2-Sublime-Packages Sublime Text 2/3 Snippets for all functions]
 
== See also ==
[[VScript]]

Latest revision as of 01:47, 20 March 2024

English (en)Русский (ru)中文 (zh)Translate (Translate)

Scripting in Dota 2 is handled by the VScript virtual machine using the Lua programming language. Lua will be launched at run time when Dota 2 loads your add-on and can manipulate most facets of the game. Scripts can control the events that happen in game modes, game rules, abilities, hero interactions, neutrals , AI, and many more.

Getting Started

The documentation presented here assumes basic knowledge of Lua. If you're new to programming and Lua it's worth spending some time at the official Lua website learning some of the basic concepts. Additional resources are available at the bottom of the page for new users.

Scripting Abilities

Common Techniques

Reference

Examples

Lua Resources

See also

VScript