Dota 2 Workshop Tools/Scripting/API/Global.LinkLuaModifier
< Dota 2 Workshop Tools | Scripting | API
Jump to navigation
Jump to search

Function Description
void LinkLuaModifier(string modifier_name, string file_path, int motion_controller_type)
链接一个已经用lua脚本定义的Modifier(类class)。如果这个Modifier脚本在根目录,第二个参数(文件路径)可以省略' 例:我们现在要创造一个Buff,名字叫modifier_evo_buff用来直接给单位加一个Buff,那么我们新建立了一个modifier_evo_buff.lua文件,文件内容
modifier_evo_buff = class({})
function modifier_evo_buff:GetTexture( )
return "abaddon_death_coil"
end
function modifier_evo_buff:GetEffectName()
return "particles/generic_gameplay/generic_stunned.vpcf"
end
function modifier_evo_buff:GetEffectAttachType()
return PATTACH_OVERHEAD_FOLLOW
end
'
- Example
LinkLuaModifier( "modifier_pudge_meat_hook", LUA_MODIFIER_MOTION_HORIZONTAL )
unit:AddNewModifier(source, ability, "modifier_pudge_meat_hook", {})
Parameters
Type | Name | Description |
---|---|---|
string | modifier_name | Name to be registered for the modifier, to be used when adding it. |
string | file_path | File path of the .lua file containing the code for the modifier. |
int | motion_controller_type | The type of motion controller(s) to be registered by this modifier |