Abilities Scripted:zh-cn

From Valve Developer Community
< Dota 2 Workshop Tools:zh-cn‎ | Scripting:zh-cn
Revision as of 11:43, 19 August 2014 by Dota2jili (talk | contribs) (Created page with "在技能中调用Lua中的函数是可能的,你能够顾使用这种方法来创造更有趣的技能, <source lang="lua"> "OnSpellStart" { "RunScript" { "ScriptFile" ...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

在技能中调用Lua中的函数是可能的,你能够顾使用这种方法来创造更有趣的技能,

"OnSpellStart"
{
	"RunScript"
	{
		"ScriptFile"		"custom_scripted_abilities.lua"
		"Function"		"Punch"
		"Target"		"POINT"
	}
}
  • ScriptFile - 包含着你想要引用的函数的lua文件路径 + 文件名。
  • Function -你要引用的函数名称
function Punch(keys)
  for k,v in pairs(keys) do
    print(k,v)
  end
end

所有需要的参数,例如施法者将会通过keys(这是一个table类型的数据)传递进lua文件,具体传递的参数将会根据 "Target" 字段的不同而不同,一般常用的Key有:

keys.caster --施法者
keys.target_entities -- 目标表
keys.ability --技能

等等。