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
No edit summary
No edit summary
 
(37 intermediate revisions by 24 users not shown)
Line 1: Line 1:
{{otherlang2
{{Dota 2Tools topicons}}
|ru= Dota 2 Workshop Tools:ru/Scripting:ru
{{Lang|title = Scripting}}
}}
[[Category:Dota 2 Workshop Tools]] [[Category:Scripting]]
Scripting in Dota 2 is handled by 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.
== 从这里开始(Getting Started) ==
* [[Dota 2 Workshop Tools/Scripting/Getting Started|从这里开始(Getting Started)]]


== 技能脚本(Scripting Abilities) ==
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|技能数据编写(Data Driven Abilities)]]
== Getting Started ==
* [[Dota 2 Workshop Tools/Scripting/Abilities Scripted|技能脚本(Scripting Abilities)]]
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.


== 常用技术(Common Techniques) ==
* [[Dota 2 Workshop Tools/Scripting/Getting Started|Getting Started]]
* [[Dota 2 Workshop Tools/Scripting/ThinkerFunctions|理解函数(Thinker Functions)]]
* [[Dota 2 Workshop Tools/Scripting/Debugging Lua scripts|Debugging Lua scripts]]
* [[Dota 2 Workshop Tools/Scripting/Console Commands|控制台命令(Console Commands)]]
* [[Dota 2 Workshop Tools/Scripting/Dedicated VConsole Log Viewer|控制台日志查看(Dedicated VConsole Log Viewer)]]


== 参考数据(Reference) ==
== Scripting Abilities ==
* [[Dota 2 Workshop Tools/Scripting/API|脚本API(Scripting API)]]
* [[Dota 2 Workshop Tools/Scripting/Abilities Data Driven|Data Driven Abilities]]
* [[Dota 2 Workshop Tools/Scripting/Constants|脚本常数(Scripting Constants)]]
* [[Dota 2 Workshop Tools/Scripting/Abilities Data Driven Examples|Data Driven Ability Examples]]
* [[Dota 2 Workshop Tools/Scripting/Built-In Engine Events|内置引擎事件((警告:有些没用了)Built-In Engine Events (warning: many broken))]]
* [[Dota_2_Workshop_Tools/Lua_Abilities_and_Modifiers|Lua Abilities and Modifiers]]
* [[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/Heroes_internal_names|内置英雄名称(Heroes Internal Names)]]
* [[Dota 2 Workshop Tools/Scripting/Built-In Unit Names|内置物品名称(Built-In Unit Names)]]


== 脚本举例 ==
== Common Techniques ==
* [[Dota 2 Workshop Tools/Scripting/Simple Trigger that calls Lua| 简单的触发器调用Lua(Simple trigger that calls 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/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/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/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]]
== Lua 学习资料 ==
* [[Dota 2 Workshop Tools/Scripting/Using Bitfields To Adjust Stat Value Bonuses | Using Bitfields To Adjust Stat Value Bonuses]]
* [http://www.lua.org/ Official Lua Website |官网]
* [[Dota 2 Workshop Tools/Scripting/Using CreateHTTPRequest | Using CreateHTTPRequest]]
* [https://github.com/bhargavrpatel/Dota-2-Sublime-Packages Sublime Text 2/3 Snippets for all functions |这个编辑器不错,可以上网找下汉化包]
* [我还是写一下打开上面那个链接后,怎么把这个插件装到Sublime里面吧。从Sublime下载,2或者3版都行。安装完后,打开安装目录,新建一个文件夹Data]
* [再运行Sublime,你就可以看到会在Data目录下自动生成了好多文件。如果不加这个Data文件夹,转为会生成到用户文件夹下,看各人喜好。            ]
* [回到上面。在Sublime里面的Package文件夹下,新建 “Lua Dota”文件夹,再把从上面网站下载的文件全部复制过去就行了。]
* [Sublime3建议下破解版,官方的不好破解。Sublime2的话,不用,因为可以无限试用。]
* [Sublime没有完美汉化包,都只是大部分汉化。2和3的汉化文件基本通用]
'''* [我只是看到脚本这块一直没人翻译,就谷歌了一下,错误应该是有的。大家好好改吧。希望国内有大大能汉化与完善这脚本模块。毕竟这里的脚本说明还是简单]'''


== Lua Resources ==
* [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]


{{shortpagetitle}}
== See also ==
[[Category:Dota 2 Workshop Tools]]
[[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