Difference between revisions of "Dota 2 Workshop Tools:zh-cn/Scripting:zh-cn/Abilities Data Driven:zh-cn"

From Valve Developer Community
Jump to: navigation, search
(Created page with "__TOC__几乎所有在DOTA2中的技能都是使用C++来编写的,当查看所有这些技能的时候,npc_abilities.txt包含了一些技能元数据的KV(Key-Values)文件...")
 
Line 1: Line 1:
 
__TOC__几乎所有在DOTA2中的技能都是使用C++来编写的,当查看所有这些技能的时候,npc_abilities.txt包含了一些技能元数据的KV(Key-Values)文件,暴露出了一些技能的键值,这里包含了几乎所有的元数据,使用数据驱动类技能系统能够为DOTA2创造一些自定义技能,能够为他们赋予特殊的数值和特定的触发事件。
 
__TOC__几乎所有在DOTA2中的技能都是使用C++来编写的,当查看所有这些技能的时候,npc_abilities.txt包含了一些技能元数据的KV(Key-Values)文件,暴露出了一些技能的键值,这里包含了几乎所有的元数据,使用数据驱动类技能系统能够为DOTA2创造一些自定义技能,能够为他们赋予特殊的数值和特定的触发事件。
  
== 一个简单的粒子 ==
+
== 一个简单的例子 ==
 
这是一个非常简单的技能,他是一个被动技能,给单位添加了一个粒子特效。
 
这是一个非常简单的技能,他是一个被动技能,给单位添加了一个粒子特效。
  
Line 43: Line 43:
  
 
  DOTA_ABILITY_BEHAVIOR_HIDDEN = 1 << 0, //这个技能是单位所拥有的技能,但是不会在HUD上显示。
 
  DOTA_ABILITY_BEHAVIOR_HIDDEN = 1 << 0, //这个技能是单位所拥有的技能,但是不会在HUD上显示。
  DOTA_ABILITY_BEHAVIOR_PASSIVE = 1 << 1, //Can't be casted like above but this one shows up on the ability HUD
+
  DOTA_ABILITY_BEHAVIOR_PASSIVE = 1 << 1, //这个技能是一个被动技能,不能被使用,但是会在HUD上显示。
  DOTA_ABILITY_BEHAVIOR_NO_TARGET = 1 << 2, //Doesn't need a target to be cast, ability fires off as soon as the button is pressed
+
  DOTA_ABILITY_BEHAVIOR_NO_TARGET = 1 << 2, //不需要指定目标就能释放的技能,当按下技能按钮的时候,这个技能就会被释放。
  DOTA_ABILITY_BEHAVIOR_UNIT_TARGET = 1 << 3, //Ability needs a target to be casted on.
+
  DOTA_ABILITY_BEHAVIOR_UNIT_TARGET = 1 << 3, //技能需要指定一个目标来释放。
  DOTA_ABILITY_BEHAVIOR_POINT = 1 << 4, //Ability can be cast anywhere the mouse cursor is (If a unit is clicked it will just be cast where the unit was standing)
+
  DOTA_ABILITY_BEHAVIOR_POINT = 1 << 4, //技能将会在鼠标指定的位置释放(如果鼠标指向了一个单位,会在单位所在的位置释放)。
  DOTA_ABILITY_BEHAVIOR_AOE = 1 << 5, //This ability draws a radius where the ability will have effect. Kinda like POINT but with a an area of effect display.
+
  DOTA_ABILITY_BEHAVIOR_AOE = 1 << 5, //这个技能将会显示技能释放的范围,有点像DOTA_ABILITY_BEHAVIOR_POINT类的技能,但是会显示一个范围。
  DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE = 1 << 6, //This ability probably can be casted or have a casting scheme but cannot be learned (these are usually abilities that are temporary like techie's bomb detonate)
+
  DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE = 1 << 6, //这个技能将能被释放,或者拥有对应的释放机制,但是不能被学习。(一般是用在类似炸弹人的引爆炸弹技能)。
  DOTA_ABILITY_BEHAVIOR_CHANNELLED = 1 << 7, //This ability is channeled. If the user moves or is silenced the ability is interrupted.
+
  DOTA_ABILITY_BEHAVIOR_CHANNELLED = 1 << 7, //持续性施法技能,如果施法者移动或者被沉默,这个技能将会被中断。
  DOTA_ABILITY_BEHAVIOR_ITEM = 1 << 8, //This ability is tied up to an item.
+
  DOTA_ABILITY_BEHAVIOR_ITEM = 1 << 8, //这个技能绑定了一个物品。
  DOTA_ABILITY_BEHAVIOR_TOGGLE = 1 << 9, //This ability can be insta-toggled
+
  DOTA_ABILITY_BEHAVIOR_TOGGLE = 1 << 9, //切换类技能。
  DOTA_ABILITY_BEHAVIOR_DIRECTIONAL = 1 << 10, //This ability has a direction from the hero, such as miranas arrow or pudge's hook
+
  DOTA_ABILITY_BEHAVIOR_DIRECTIONAL = 1 << 10, //这个技能是一个从英雄出发的方向性技能,比如米拉娜的月之神剑或者屠夫的肉钩。
  DOTA_ABILITY_BEHAVIOR_IMMEDIATE = 1 << 11, //This ability can be used instantly without going into the action queue
+
  DOTA_ABILITY_BEHAVIOR_IMMEDIATE = 1 << 11, //这个技能将会被立即释放,不会进入动作序列。
  DOTA_ABILITY_BEHAVIOR_AUTOCAST = 1 << 12, //This ability can be casted automatically
+
  DOTA_ABILITY_BEHAVIOR_AUTOCAST = 1 << 12, //这个技能可以被自动释放。
  DOTA_ABILITY_BEHAVIOR_NOASSIST = 1 << 13, //This ability has no reticle assist
+
  DOTA_ABILITY_BEHAVIOR_NOASSIST = 1 << 13, //这个技能将不会有辅助网格。
  DOTA_ABILITY_BEHAVIOR_AURA = 1 << 14, //This ability is an aura. We don't really use this other than to tag the ability as so
+
  DOTA_ABILITY_BEHAVIOR_AURA = 1 << 14, //这个技能是一个光环技能,
  DOTA_ABILITY_BEHAVIOR_ATTACK = 1 << 15, //This ability is an attack and cannot hit attack-immune targets
+
  DOTA_ABILITY_BEHAVIOR_ATTACK = 1 << 15, //这个技能是一个法球技能,不能对魔法免疫目标生效,
  DOTA_ABILITY_BEHAVIOR_DONT_RESUME_MOVEMENT = 1 << 16, //This ability should not resume movement when it completes. Only applicable to no-target, non-immediate abilities.
+
  DOTA_ABILITY_BEHAVIOR_DONT_RESUME_MOVEMENT = 1 << 16, //这个技能在释放完成之后不会继续之前的移动动作,只能和无目标或者立即释放类技能配合使用。
  DOTA_ABILITY_BEHAVIOR_ROOT_DISABLES = 1 << 17, //This ability cannot be used when rooted
+
  DOTA_ABILITY_BEHAVIOR_ROOT_DISABLES = 1 << 17, //这个技能在单位被定身的时候无法使用。
  DOTA_ABILITY_BEHAVIOR_UNRESTRICTED = 1 << 18, //This ability is allowed when commands are restricted
+
  DOTA_ABILITY_BEHAVIOR_UNRESTRICTED = 1 << 18, //这个技能在释放指令被限制的时候也能被使用。
  DOTA_ABILITY_BEHAVIOR_IGNORE_PSEUDO_QUEUE = 1 << 19, //This ability can be executed while stunned, casting, or force-attacking. Only applicable to toggled abilities.
+
  DOTA_ABILITY_BEHAVIOR_IGNORE_PSEUDO_QUEUE = 1 << 19, //这个技能在被眩晕,施法和被强制攻击的时候也能使用,只能和自动释放类DOTA_ABILITY_BEHAVIOR_AUTOCAST配合使用。
  DOTA_ABILITY_BEHAVIOR_IGNORE_CHANNEL = 1 << 20, //This ability can be executed without interrupting channels
+
  DOTA_ABILITY_BEHAVIOR_IGNORE_CHANNEL = 1 << 20, //这个技能即使施法被中断也能继续释放。
  DOTA_ABILITY_BEHAVIOR_DONT_CANCEL_MOVEMENT  = 1 << 21, //This ability doesn't cause certain modifiers to end, used for courier and speed burst
+
  DOTA_ABILITY_BEHAVIOR_DONT_CANCEL_MOVEMENT  = 1 << 21, //This ability doesn't cause certain modifiers to end,目前未知,只在信使的速度爆发有见到。
  DOTA_ABILITY_BEHAVIOR_DONT_ALERT_TARGET = 1 << 22, //This ability does not alert enemies when target-cast on them
+
  DOTA_ABILITY_BEHAVIOR_DONT_ALERT_TARGET = 1 << 22, //这个技能在指定敌人释放的时候将不会惊醒他们。
  DOTA_ABILITY_BEHAVIOR_DONT_RESUME_ATTACK = 1 << 23, //This ability should not resume command-attacking the previous target when it completes. Only applicable to no-target, non-immediate abilities and unit-target abilities.
+
  DOTA_ABILITY_BEHAVIOR_DONT_RESUME_ATTACK = 1 << 23, //这个技能在释放完成之后,将不会恢复对之前目标的自动攻击,只能配合无目标,非立即释放类和指定单位目标类技能使用。
  DOTA_ABILITY_BEHAVIOR_NORMAL_WHEN_STOLEN = 1 << 24, //This ability still uses its normal cast point when stolen.
+
  DOTA_ABILITY_BEHAVIOR_NORMAL_WHEN_STOLEN = 1 << 24, //这个技能在被偷取之后,依然使用之前的施法前摇。
  DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING = 1 << 25, //This ability ignores backswing psuedoqueue
+
  DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING = 1 << 25, //这个技能将会无视施法后摇。
  DOTA_ABILITY_BEHAVIOR_RUNE_TARGET = 1 << 26, //TArgets Runes
+
  DOTA_ABILITY_BEHAVIOR_RUNE_TARGET = 1 << 26, //这个技能能以神符为目标。
  
  
"AbilityTextureName" is the icon that should be used in the UI for this ability. You can use this to borrow the icon from another ability just by putting that ability name here.
+
技能图标名称"AbilityTextureName" 是指在UI中显示的技能图标,你可以放一个其他技能的技能名称在此处来使用它,(或者你也可以引用 reource\flash3\images\spellicons文件夹中的.png文件名来定义自定义的图标 - 译者注)
  
"Modifiers" is unique to data-driven abilities. This block describes a set of modifiers (a.k.a. Buffs) that are unique to this ability. Each modifier is named by the name of the keyvalues block that defines the modifier.
+
"Modifiers" 是只有data-driven类技能才能使用的,这个区域定义了一系列的Modifiers(一般可以认为是Buff或者DeBuff),每个Modifier通过在其中定义的KV(KeyValues)来定义。
  
"Passive" in a modifier flags the modifier as a passive modifier that should automatically be applied to the ability owner.
+
被动("Passive") 在Modifier中的被动字段,定义这个Modifier在这个技能被学习之后,将能自动施加给目标。
  
"OnCreated" is an action block that is triggered when the ability is first attached to the owner. In this example, we attach a visual effect to the ability caster.
+
当创建时("OnCreated")是一个出发区域,当这个Modifier被第一次施加给这个单位的时候会被触发,在本例中,我们在触发之后给施法者施加了一个粒子特效。
  
== Ability Events and Actions ==
+
== 技能触发事件和动作 ==
  
Abilities have various in-game events which can trigger behaviour. The events that can trigger actions on an ability are:
+
引擎为技能提供了一系列触发事件,这些事件将能够在技能中触发:
  
  "OnChannelFinish"
+
  "OnChannelFinish"     //当持续性施法完成
  "OnChannelInterrupted"
+
  "OnChannelInterrupted" //当持续性施法被中断
  "OnChannelSucceeded"
+
  "OnChannelSucceeded"   //当持续性施法成功
  "OnOwnerDied"
+
  "OnOwnerDied"         //当拥有者死亡
  "OnOwnerSpawned"
+
  "OnOwnerSpawned"       //当拥有者出生
  "OnProjectileFinish"
+
  "OnProjectileFinish"   //当弹道粒子特效结束
  "OnProjectileHitUnit"
+
  "OnProjectileHitUnit" //当弹道粒子特效命中单位
  "OnSpellStart"
+
  "OnSpellStart"         //当技能施法开始
  "OnToggleOff"
+
  "OnToggleOff"         //当切换为关闭状态
  "OnToggleOn"
+
  "OnToggleOn"           //当切换为开启状态
  "OnUpgrade"
+
  "OnUpgrade"           //当升级
  
 
    
 
    
Each of these keys is a block that contains one or more action descriptions. The actions you can use are:
+
以下是你在技能中能够在动作中使用的一些Key:
  
  "AddAbility"
+
  "AddAbility"  
 
     "Target", "AbilityName"
 
     "Target", "AbilityName"
  
Line 159: Line 159:
 
     "EffectName", "Dodgeable", "ProvidesVision", "VisionRadius", "MoveSpeed", "SourceAttachment"
 
     "EffectName", "Dodgeable", "ProvidesVision", "VisionRadius", "MoveSpeed", "SourceAttachment"
  
{{note|<code>AddAbility</code> adds a new ability at level 0.  <code>RemoveAbility</code> deletes the ability even if it has been leveled.  More complex ability management should be done through script as opposed to the data driven system.}}
+
{{note|<code>AddAbility</code> (增加技能)将会给单位添加一个0级的技能。 <code>RemoveAbility</code> (移除技能)将会移除对应技能(哪怕它已经升级了),更复杂的技能管理,应当通过程序来制作。}}
  
== Action Targets ==
+
== 动作目标 ==
  
Target selection for actions exposes some choices. A "Target" key can have a value of "CASTER", "TARGET", "POINT", "ATTACKER" or "UNIT" for simple single-target selection. These names mean different things in different events - experiment to discover exactly what in each case.
+
目标选择将会给动作提供一系列目标,一个目标("Target")键将能够使用 "CASTER"(施法者), "TARGET"(目标), "POINT"(点), "ATTACKER"(攻击者)或者 "UNIT" (单位)来提供一个单体目标的的选择,在不同的动作中,这些字段提供的是不同的目标,你需要自己实际使用一下才能明白。
  
For selecting multiple targets in an area, make the "Target" key a block with the following subkeys:
+
为了选择多个目标,应该为"Target"键提供以下子键:
 
  "Center" - "CASTER", "TARGET", "POINT", "PROJECTILE", "UNIT", "ATTACKER"
 
  "Center" - "CASTER", "TARGET", "POINT", "PROJECTILE", "UNIT", "ATTACKER"
  "Radius" - The radius to search for target(s) in.
+
  "Radius" - 搜索目标的范围
  
  "Teams" - Target team(s)
+
  "Teams" - 目标的队伍(一样可以用 | 来指定多种类型)
 
   
 
   
 
  DOTA_UNIT_TARGET_TEAM_BOTH
 
  DOTA_UNIT_TARGET_TEAM_BOTH
Line 177: Line 177:
 
  DOTA_UNIT_TARGET_TEAM_NONE
 
  DOTA_UNIT_TARGET_TEAM_NONE
  
  "Types" - Target units of specified type
+
  "Types" - 指定的类型
  "ExcludeTypes" - Reject units of the specified type
+
  "ExcludeTypes" - 排除对应的类型(一样可以用 | 来指定多种类型)
 
   
 
   
 
  DOTA_UNIT_TARGET_ALL
 
  DOTA_UNIT_TARGET_ALL
Line 192: Line 192:
 
  DOTA_UNIT_TARGET_TREE
 
  DOTA_UNIT_TARGET_TREE
  
  "Flags" - Target units with specified flags
+
  "Flags" - 指定目标的状态
  "ExcludeFlags" - Reject units with specified flag
+
  "ExcludeFlags" - 排除对应状态的目标(一样可以用 | 来指定多种类型)
 
   
 
   
 
  DOTA_UNIT_TARGET_FLAG_CHECK_DISABLE_HELP
 
  DOTA_UNIT_TARGET_FLAG_CHECK_DISABLE_HELP
Line 216: Line 216:
 
  DOTA_UNIT_TARGET_FLAG_RANGED_ONLY
 
  DOTA_UNIT_TARGET_FLAG_RANGED_ONLY
  
  "MaxTargets" - Maximum number of targets to select
+
  "MaxTargets" - 最多目标数量
  "Random" - Whether to select a random unit if more than MaxTargets exist [Boolean]
+
  "Random" - (布尔值)在指定了最多目标数量之后,是否额外随机多选择一个单位。
  
 
  "ScriptSelectPoints"
 
  "ScriptSelectPoints"
 
       "ScriptFile", "Function", "Radius", "Count"
 
       "ScriptFile", "Function", "Radius", "Count"
  
{{note|<code>Random</code> set to 0 in conjunction with a <code>MaxTargets</code> value will cause the ability to only function if there is <code>MaxTargets</code> or less targets in the area.}}
+
{{note|<code>Random</code> <code>MaxTargets</code> 共同使用,将<code>Random</code> 设置为0将会使动作只影响目标区域内<code>MaxTargets</code>或者更少的单位。}}
  
== Modifier Properties ==
+
== Modifier 属性 ==
  
Modifier properties are gameplay values a modifier can change on the unit it is applied to. Here's a simple example of a modifier that slows attacks and movement speed (this chunk is a block inside the "Modifiers" block of an ability). To specify numeric values, you can put in a number or you can use %name formatting to grab values out of the AbilitySpecial block of the Ability. The advantage to using the %name syntax is that the value can change as the ability levels up and the numeric value can be formatted into tooltips. In this example, the slow duration comes from an AbilitySpecial block, but the slow values are just numbers.
+
Modifier属性能够改变对应Modifier影响的单位的游戏相关数值,以下示例定义的是一个降低目标攻击和移动速度的modifier(写在技能的Modifiers区域内),对于数值,你可以直接在区域直接写入数值,也可以使用 %name 来引用 AbilitySpecial区域内定义的数值,使用%name的好处是你能够针对不同的技能等级定义不同的数值,也可以在技能的说明中直接引用这个数值,在本示例中,Modifier的持续时间("Duration")引用了AbilitySpecial中的数值,减速的数值是直接写的数字。
  
 
  "creature_slithereen_crush_slow"
 
  "creature_slithereen_crush_slow"
Line 238: Line 238:
 
  }
 
  }
  
Here is a list of the properties you can put in a modifier:
+
以下是能够使用的Modifier属性:
  
 
  MODIFIER_PROPERTY_ABSOLUTE_NO_DAMAGE_MAGICAL
 
  MODIFIER_PROPERTY_ABSOLUTE_NO_DAMAGE_MAGICAL
Line 336: Line 336:
 
  MODIFIER_PROPERTY_TURN_RATE_PERCENTAGE
 
  MODIFIER_PROPERTY_TURN_RATE_PERCENTAGE
  
== Modifier States ==
+
== Modifier 状态 ==
  
States are very similar to properties, except they are tri-state values. A state can have the value "MODIFIER_STATE_VALUE_NO_ACTION", "MODIFIER_STATE_VALUE_ENABLED" or "MODIFIER_STATE_VALUE_DISABLED". This example modifier attaches a simple stunned effect, overrides the base unit's animation and forces the unit into the stunned state:
+
Modifier状态和Modifier属性十分类似,只不过他们是只有三个数值:"MODIFIER_STATE_VALUE_NO_ACTION", "MODIFIER_STATE_VALUE_ENABLED" 或者 "MODIFIER_STATE_VALUE_DISABLED"。以下的modifier示例给单位添加了一个简单的眩晕粒子特效,覆盖了单位的模型动作,让单位进入了眩晕状态。
  
 
  "creature_bash_ministun"
 
  "creature_bash_ministun"
Line 354: Line 354:
  
  
Here is a list of all the states available to a modifier:
+
以下是可以使用的Modifier状态:
  
 
  MODIFIER_STATE_ATTACK_IMMUNE
 
  MODIFIER_STATE_ATTACK_IMMUNE
Line 389: Line 389:
 
  MODIFIER_STATE_UNSELECTABLE
 
  MODIFIER_STATE_UNSELECTABLE
  
== Modifier Events ==
+
== Modifier 事件 ==
  
Here is a list of all the events available to a modifier:
+
以下是可以使用的Modifier事件:
  
 
  MODIFIER_EVENT_ON_ABILITY_END_CHANNEL
 
  MODIFIER_EVENT_ON_ABILITY_END_CHANNEL
Line 422: Line 422:
 
  MODIFIER_EVENT_ON_UNIT_MOVED
 
  MODIFIER_EVENT_ON_UNIT_MOVED
  
Modifiers can also describe actions that should happen on various in-game events. Each of these keys is a block that describes actions - the action description system is documented elsewhere on this page. The events that are supported are:
+
Modifiers也可以定义一些触发事件,以下的这些事件能够在modifier中定义 - 动作在本页面其他位置已经提及了时
 
   
 
   
  OnAttacked - The unit this modifier is attached to has been attacked.
+
  OnAttacked - 当拥有modifier的单位被攻击时
  OnAttackLanded - The unit this modifier is attached to has landed an attack on a target.
+
  OnAttackLanded - 当拥有modifier的单位攻击到某个目标时
  OnAttackStart - The unit this modifier is attached to has started to attack a target.
+
  OnAttackStart -当拥有modifier的单位开始攻击某个目标
  OnCreated - The modifier has been created.
+
  OnCreated -当modifier被创建时
  OnDealDamage - The unit this modifier is attached to has dealt damage.
+
  OnDealDamage - 当拥有modifier的单位施加伤害的时候
  OnDeath
+
  OnDeath - 当拥有modifier的单位死亡的时候
  OnDestroy - The modifier has been removed.
+
  OnDestroy - 当这个modifier被移除的时候
  OnOrbFire
+
  OnOrbFire - 当法球modifier的法球被释放的时候
  OnOrbImpact
+
  OnOrbImpact - 当法球modifier的法球命中目标之后
  OnTakeDamage - The unit this modifier is attached to has taken damage.
+
  OnTakeDamage - 当拥有modifier的单位受到伤害的时候
  Orb
+
  Orb - 定义一个法球modifeir的特效等
  
== A More Complex Example ==
+
== 一个更复杂的例子 ==
  
Here is an ability that waits for the owner to die. On death, a thinker is created with an acid pool visual effect and an aura modifier which reduces armor and applies a damage over time effect.
+
本示例在技能被添加之后,将会等到拥有者死亡之后触发,当拥有者死亡的时候,一个带有酸雾特效和一个降低目标区域的单位护甲并施加伤害的计时器将会被创建。
  
 
  //=================================================================================================================
 
  //=================================================================================================================
Line 542: Line 542:
  
 
{{shortpagetitle}}
 
{{shortpagetitle}}
[[Category:Dota 2 Workshop Tools]]
+
[[Category:Dota 2 创意工坊工具]]

Revision as of 11:37, 19 August 2014

几乎所有在DOTA2中的技能都是使用C++来编写的,当查看所有这些技能的时候,npc_abilities.txt包含了一些技能元数据的KV(Key-Values)文件,暴露出了一些技能的键值,这里包含了几乎所有的元数据,使用数据驱动类技能系统能够为DOTA2创造一些自定义技能,能够为他们赋予特殊的数值和特定的触发事件。

一个简单的例子

这是一个非常简单的技能,他是一个被动技能,给单位添加了一个粒子特效。

"fx_test_ability"
{
 // General
 //-------------------------------------------------------------------------------------------------------------
 "BaseClass"			"ability_datadriven"
 "AbilityBehavior"		"DOTA_ABILITY_BEHAVIOR_PASSIVE"
 "AbilityTextureName"		"axe_battle_hunger"
 // Modifiers
 //-------------------------------------------------------------------------------------------------------------
 "Modifiers"
 {
  "fx_test_modifier"
  {
   "Passive" "1"
   "OnCreated"
   {
    "AttachEffect"
    {
     "Target" "CASTER"
     "EffectName" "generic_buff_1"
     "EffectAttachType" "follow_overhead"
     "EffectLifeDurationScale" "1"
     "EffectColorA" "255 255 0"
    }
   }
  }
 }
}


其中,基类("BaseClass"),技能类型("AbilityBehavior")和技能图标名称("AbilityTextureName")在所有技能中都是类似的:

基类("BaseClass") - 一般来说,DOTA通过技能的名字(在这里是"fx_test_ability")来将技能连接到C++中对应的类,如果你想让DOTA强制使用不同的C++类,这个基类("BaseClass")键将能完成这项工作 - 我们在这个技能中将基类定义为 ability_datadriven,来将技能连接到数据驱动技能类,将技能连接到其他已经存在的技能,通过修改KV(KeyValues)来重新定义他们的变量是可行的。

"ID" - ID是用来给跟踪技能状态的一个特定数值,在数据驱动类技能中不需要使用这个。

技能类型("AbilityBehavior") - 技能类型通过一系列的常量来定义这个技能的属性,你能够使用|来分割不同的常量,比如说 "DOTA_ABILITY_BEHAVIOR_HIDDEN | DOTA_ABILITY_BEHAVIOR_NO_TARGET" - 这些空格是很重要的!

DOTA_ABILITY_BEHAVIOR_HIDDEN				= 1 << 0, //这个技能是单位所拥有的技能,但是不会在HUD上显示。
DOTA_ABILITY_BEHAVIOR_PASSIVE				= 1 << 1, //这个技能是一个被动技能,不能被使用,但是会在HUD上显示。
DOTA_ABILITY_BEHAVIOR_NO_TARGET				= 1 << 2, //不需要指定目标就能释放的技能,当按下技能按钮的时候,这个技能就会被释放。
DOTA_ABILITY_BEHAVIOR_UNIT_TARGET			= 1 << 3, //技能需要指定一个目标来释放。
DOTA_ABILITY_BEHAVIOR_POINT					= 1 << 4, //技能将会在鼠标指定的位置释放(如果鼠标指向了一个单位,会在单位所在的位置释放)。
DOTA_ABILITY_BEHAVIOR_AOE					= 1 << 5, //这个技能将会显示技能释放的范围,有点像DOTA_ABILITY_BEHAVIOR_POINT类的技能,但是会显示一个范围。
DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE			= 1 << 6, //这个技能将能被释放,或者拥有对应的释放机制,但是不能被学习。(一般是用在类似炸弹人的引爆炸弹技能)。
DOTA_ABILITY_BEHAVIOR_CHANNELLED			= 1 << 7, //持续性施法技能,如果施法者移动或者被沉默,这个技能将会被中断。
DOTA_ABILITY_BEHAVIOR_ITEM					= 1 << 8, //这个技能绑定了一个物品。
DOTA_ABILITY_BEHAVIOR_TOGGLE				= 1 << 9, //切换类技能。
DOTA_ABILITY_BEHAVIOR_DIRECTIONAL			= 1 << 10, //这个技能是一个从英雄出发的方向性技能,比如米拉娜的月之神剑或者屠夫的肉钩。
DOTA_ABILITY_BEHAVIOR_IMMEDIATE				= 1 << 11, //这个技能将会被立即释放,不会进入动作序列。
DOTA_ABILITY_BEHAVIOR_AUTOCAST				= 1 << 12, //这个技能可以被自动释放。
DOTA_ABILITY_BEHAVIOR_NOASSIST				= 1 << 13, //这个技能将不会有辅助网格。
DOTA_ABILITY_BEHAVIOR_AURA					= 1 << 14, //这个技能是一个光环技能,
DOTA_ABILITY_BEHAVIOR_ATTACK				= 1 << 15, //这个技能是一个法球技能,不能对魔法免疫目标生效,
DOTA_ABILITY_BEHAVIOR_DONT_RESUME_MOVEMENT	= 1 << 16, //这个技能在释放完成之后不会继续之前的移动动作,只能和无目标或者立即释放类技能配合使用。
DOTA_ABILITY_BEHAVIOR_ROOT_DISABLES			= 1 << 17, //这个技能在单位被定身的时候无法使用。
DOTA_ABILITY_BEHAVIOR_UNRESTRICTED			= 1 << 18, //这个技能在释放指令被限制的时候也能被使用。
DOTA_ABILITY_BEHAVIOR_IGNORE_PSEUDO_QUEUE	= 1 << 19, //这个技能在被眩晕,施法和被强制攻击的时候也能使用,只能和自动释放类DOTA_ABILITY_BEHAVIOR_AUTOCAST配合使用。
DOTA_ABILITY_BEHAVIOR_IGNORE_CHANNEL		= 1 << 20, //这个技能即使施法被中断也能继续释放。
DOTA_ABILITY_BEHAVIOR_DONT_CANCEL_MOVEMENT  = 1 << 21, //This ability doesn't cause certain modifiers to end,目前未知,只在信使的速度爆发有见到。
DOTA_ABILITY_BEHAVIOR_DONT_ALERT_TARGET		= 1 << 22, //这个技能在指定敌人释放的时候将不会惊醒他们。
DOTA_ABILITY_BEHAVIOR_DONT_RESUME_ATTACK	= 1 << 23, //这个技能在释放完成之后,将不会恢复对之前目标的自动攻击,只能配合无目标,非立即释放类和指定单位目标类技能使用。
DOTA_ABILITY_BEHAVIOR_NORMAL_WHEN_STOLEN	= 1 << 24, //这个技能在被偷取之后,依然使用之前的施法前摇。
DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING		= 1 << 25, //这个技能将会无视施法后摇。
DOTA_ABILITY_BEHAVIOR_RUNE_TARGET			= 1 << 26, //这个技能能以神符为目标。


技能图标名称"AbilityTextureName" 是指在UI中显示的技能图标,你可以放一个其他技能的技能名称在此处来使用它,(或者你也可以引用 reource\flash3\images\spellicons文件夹中的.png文件名来定义自定义的图标 - 译者注)

"Modifiers" 是只有data-driven类技能才能使用的,这个区域定义了一系列的Modifiers(一般可以认为是Buff或者DeBuff),每个Modifier通过在其中定义的KV(KeyValues)来定义。

被动("Passive") 在Modifier中的被动字段,定义这个Modifier在这个技能被学习之后,将能自动施加给目标。

当创建时("OnCreated")是一个出发区域,当这个Modifier被第一次施加给这个单位的时候会被触发,在本例中,我们在触发之后给施法者施加了一个粒子特效。

技能触发事件和动作

引擎为技能提供了一系列触发事件,这些事件将能够在技能中触发:

"OnChannelFinish"      //当持续性施法完成
"OnChannelInterrupted" //当持续性施法被中断
"OnChannelSucceeded"   //当持续性施法成功
"OnOwnerDied"          //当拥有者死亡
"OnOwnerSpawned"       //当拥有者出生
"OnProjectileFinish"   //当弹道粒子特效结束
"OnProjectileHitUnit"  //当弹道粒子特效命中单位
"OnSpellStart"         //当技能施法开始
"OnToggleOff"          //当切换为关闭状态
"OnToggleOn"           //当切换为开启状态
"OnUpgrade"            //当升级


以下是你在技能中能够在动作中使用的一些Key:

"AddAbility" 
   "Target", "AbilityName"
"ActOnTargets"
   "Target", "Action"
"ApplyModifier"
   "Target", "ModifierName"
"AttachEffect"
   "EffectName", "EffectAttachType", "Target", "ControlPoints"
"Blink"
   "Target" (position to blink to)
"CreateThinker"
   "Target", "ModifierName"
"Damage"
   "Target", "Type", "MinDamage"/"MaxDamage" or "Damage"
"DestroyTrees"
   "Target", "Radius"
"FireEffect"
   "EffectName", "EffectAttachType", "Target", "ControlPoints"
"FireSound"
   "EffectName", "Target"
"Knockback"
   "Target", "Center", "Duration", "Distance", "Height", "IsFixedDistance", "ShouldStun"
"LevelUpAbility"
   "Target", "AbilityName"
"Lifesteal"
   "Target", "LifestealPercent"
"LinearProjectile"
   "Target", "EffectName", "MoveSpeed", "StartRadius", "EndRadius", "FixedDistance", "StartPosition", "TargetTeams", 
   "TargetTypes", "TargetFlags", "HasFrontalCone", "ProvidesVision", "VisionRadius"
"Random"
   "Chance", "PseudoRandom", "OnSuccess", "OnFailure"
"RemoveAbility"
   "Target", "AbilityName"
"RemoveModifier"
   "Target", "ModifierName"
"SpawnUnit"
   "UnitName", "UnitCount", "UnitLimit", "SpawnRadius", "Duration", "Target", "GrantsGold", "GrantsXP"
"Stun"
   "Target", "Duration"
"TrackingProjectile"
   "EffectName", "Dodgeable", "ProvidesVision", "VisionRadius", "MoveSpeed", "SourceAttachment"
Note:AddAbility (增加技能)将会给单位添加一个0级的技能。 RemoveAbility (移除技能)将会移除对应技能(哪怕它已经升级了),更复杂的技能管理,应当通过程序来制作。

动作目标

目标选择将会给动作提供一系列目标,一个目标("Target")键将能够使用 "CASTER"(施法者), "TARGET"(目标), "POINT"(点), "ATTACKER"(攻击者)或者 "UNIT" (单位)来提供一个单体目标的的选择,在不同的动作中,这些字段提供的是不同的目标,你需要自己实际使用一下才能明白。

为了选择多个目标,应该为"Target"键提供以下子键:

"Center" - "CASTER", "TARGET", "POINT", "PROJECTILE", "UNIT", "ATTACKER"
"Radius" - 搜索目标的范围
"Teams" - 目标的队伍(一样可以用 | 来指定多种类型)

DOTA_UNIT_TARGET_TEAM_BOTH
DOTA_UNIT_TARGET_TEAM_CUSTOM
DOTA_UNIT_TARGET_TEAM_ENEMY
DOTA_UNIT_TARGET_TEAM_FRIENDLY
DOTA_UNIT_TARGET_TEAM_NONE
"Types" - 指定的类型
"ExcludeTypes" - 排除对应的类型(一样可以用 | 来指定多种类型)

DOTA_UNIT_TARGET_ALL
DOTA_UNIT_TARGET_BASIC
DOTA_UNIT_TARGET_BUILDING
DOTA_UNIT_TARGET_COURIER
DOTA_UNIT_TARGET_CREEP
DOTA_UNIT_TARGET_CUSTOM
DOTA_UNIT_TARGET_HERO
DOTA_UNIT_TARGET_MECHANICAL
DOTA_UNIT_TARGET_NONE
DOTA_UNIT_TARGET_OTHER
DOTA_UNIT_TARGET_TREE
"Flags" - 指定目标的状态
"ExcludeFlags" - 排除对应状态的目标(一样可以用 | 来指定多种类型)

DOTA_UNIT_TARGET_FLAG_CHECK_DISABLE_HELP
DOTA_UNIT_TARGET_FLAG_DEAD
DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE
DOTA_UNIT_TARGET_FLAG_INVULNERABLE
DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES
DOTA_UNIT_TARGET_FLAG_MANA_ONLY
DOTA_UNIT_TARGET_FLAG_MELEE_ONLY
DOTA_UNIT_TARGET_FLAG_NO_INVIS
DOTA_UNIT_TARGET_FLAG_NONE
DOTA_UNIT_TARGET_FLAG_NOT_ANCIENTS
DOTA_UNIT_TARGET_FLAG_NOT_ATTACK_IMMUNE
DOTA_UNIT_TARGET_FLAG_NOT_CREEP_HERO
DOTA_UNIT_TARGET_FLAG_NOT_DOMINATED
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS
DOTA_UNIT_TARGET_FLAG_NOT_MAGIC_IMMUNE_ALLIES
DOTA_UNIT_TARGET_FLAG_NOT_NIGHTMARED
DOTA_UNIT_TARGET_FLAG_NOT_SUMMONED
DOTA_UNIT_TARGET_FLAG_OUT_OF_WORLD
DOTA_UNIT_TARGET_FLAG_PLAYER_CONTROLLED
DOTA_UNIT_TARGET_FLAG_RANGED_ONLY
"MaxTargets" - 最多目标数量
"Random" - (布尔值)在指定了最多目标数量之后,是否额外随机多选择一个单位。
"ScriptSelectPoints"
     "ScriptFile", "Function", "Radius", "Count"
Note:RandomMaxTargets 共同使用,将Random 设置为0将会使动作只影响目标区域内MaxTargets或者更少的单位。

Modifier 属性

Modifier属性能够改变对应Modifier影响的单位的游戏相关数值,以下示例定义的是一个降低目标攻击和移动速度的modifier(写在技能的Modifiers区域内),对于数值,你可以直接在区域直接写入数值,也可以使用 %name 来引用 AbilitySpecial区域内定义的数值,使用%name的好处是你能够针对不同的技能等级定义不同的数值,也可以在技能的说明中直接引用这个数值,在本示例中,Modifier的持续时间("Duration")引用了AbilitySpecial中的数值,减速的数值是直接写的数字。

"creature_slithereen_crush_slow"
{
 "Duration"	"%slow_duration"
 "Properties"
 {
   "MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE" "-20"
   "MODIFIER_PROPERTY_ATTACKSPEED_BONUS_PERCENTAGE" "-20"
 }
}

以下是能够使用的Modifier属性:

MODIFIER_PROPERTY_ABSOLUTE_NO_DAMAGE_MAGICAL
MODIFIER_PROPERTY_ABSOLUTE_NO_DAMAGE_PHYSICAL
MODIFIER_PROPERTY_ABSOLUTE_NO_DAMAGE_PURE
MODIFIER_PROPERTY_ABSORB_SPELL
MODIFIER_PROPERTY_ATTACK_RANGE_BONUS
MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT
MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT_POWER_TREADS
MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT_SECONDARY
MODIFIER_PROPERTY_AVOID_CONSTANT
MODIFIER_PROPERTY_AVOID_SPELL
MODIFIER_PROPERTY_BASEATTACK_BONUSDAMAGE
MODIFIER_PROPERTY_BASE_ATTACK_TIME_CONSTANT
MODIFIER_PROPERTY_BASEDAMAGEOUTGOING_PERCENTAGE
MODIFIER_PROPERTY_BASE_MANA_REGEN
MODIFIER_PROPERTY_BONUS_DAY_VISION
MODIFIER_PROPERTY_BONUS_NIGHT_VISION
MODIFIER_PROPERTY_BONUS_VISION_PERCENTAGE
MODIFIER_PROPERTY_CHANGE_ABILITY_VALUE
MODIFIER_PROPERTY_COOLDOWN_REDUCTION_CONSTANT
MODIFIER_PROPERTY_DAMAGEOUTGOING_PERCENTAGE
MODIFIER_PROPERTY_DAMAGEOUTGOING_PERCENTAGE_ILLUSION
MODIFIER_PROPERTY_DEATHGOLDCOST
MODIFIER_PROPERTY_DISABLE_AUTOATTACK
MODIFIER_PROPERTY_DISABLE_HEALING
MODIFIER_PROPERTY_DISABLE_TURNING
MODIFIER_PROPERTY_EVASION_CONSTANT
MODIFIER_PROPERTY_EXTRA_HEALTH_BONUS
MODIFIER_PROPERTY_EXTRA_MANA_BONUS
MODIFIER_PROPERTY_EXTRA_STRENGTH_BONUS
MODIFIER_PROPERTY_FORCE_DRAW_MINIMAP
MODIFIER_PROPERTY_HEALTH_BONUS
MODIFIER_PROPERTY_HEALTH_REGEN_CONSTANT
MODIFIER_PROPERTY_HEALTH_REGEN_PERCENTAGE
MODIFIER_PROPERTY_IGNORE_CAST_ANGLE
MODIFIER_PROPERTY_INCOMING_DAMAGE_PERCENTAGE
MODIFIER_PROPERTY_INCOMING_PHYSICAL_DAMAGE_PERCENTAGE
MODIFIER_PROPERTY_INCOMING_SPELL_DAMAGE_CONSTANT
MODIFIER_PROPERTY_INVISIBILITY_LEVEL
MODIFIER_PROPERTY_IS_ILLUSION
MODIFIER_PROPERTY_IS_SCEPTER
MODIFIER_PROPERTY_LIFETIME_FRACTION
MODIFIER_PROPERTY_MAGICAL_RESISTANCE_BONUS
MODIFIER_PROPERTY_MAGICAL_RESISTANCE_DECREPIFY_UNIQUE
MODIFIER_PROPERTY_MAGICAL_RESISTANCE_ITEM_UNIQUE
MODIFIER_PROPERTY_MANA_BONUS
MODIFIER_PROPERTY_MANA_REGEN_CONSTANT
MODIFIER_PROPERTY_MANA_REGEN_CONSTANT_UNIQUE
MODIFIER_PROPERTY_MANA_REGEN_PERCENTAGE
MODIFIER_PROPERTY_MANA_REGEN_TOTAL_PERCENTAGE
MODIFIER_PROPERTY_MIN_HEALTH
MODIFIER_PROPERTY_MISS_PERCENTAGE
MODIFIER_PROPERTY_MODEL_CHANGE
MODIFIER_PROPERTY_MODEL_SCALE
MODIFIER_PROPERTY_MOVESPEED_ABSOLUTE
MODIFIER_PROPERTY_MOVESPEED_BASE_OVERRIDE
MODIFIER_PROPERTY_MOVESPEED_BONUS_CONSTANT
MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE
MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE_UNIQUE
MODIFIER_PROPERTY_MOVESPEED_BONUS_UNIQUE
MODIFIER_PROPERTY_MOVESPEED_LIMIT
MODIFIER_PROPERTY_MOVESPEED_MAX
MODIFIER_PROPERTY_OVERRIDE_ANIMATION
MODIFIER_PROPERTY_OVERRIDE_ANIMATION_RATE
MODIFIER_PROPERTY_OVERRIDE_ANIMATION_WEIGHT
MODIFIER_PROPERTY_OVERRIDE_ATTACK_MAGICAL
MODIFIER_PROPERTY_PERSISTENT_INVISIBILITY
MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS
MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS_ILLUSIONS
MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS_UNIQUE
MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS_UNIQUE_ACTIVE
MODIFIER_PROPERTY_PHYSICAL_CONSTANT_BLOCK
MODIFIER_PROPERTY_POST_ATTACK
MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE
MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE_POST_CRIT
MODIFIER_PROPERTY_PREATTACK_CRITICALSTRIKE
MODIFIER_PROPERTY_PROCATTACK_BONUS_DAMAGE_COMPOSITE
MODIFIER_PROPERTY_PROCATTACK_BONUS_DAMAGE_MAGICAL
MODIFIER_PROPERTY_PROCATTACK_BONUS_DAMAGE_PHYSICAL
MODIFIER_PROPERTY_PROCATTACK_BONUS_DAMAGE_PURE
MODIFIER_PROPERTY_PROCATTACK_FEEDBACK
MODIFIER_PROPERTY_PROVIDES_FOW_POSITION
MODIFIER_PROPERTY_REINCARNATION
MODIFIER_PROPERTY_RESPAWNTIME
MODIFIER_PROPERTY_RESPAWNTIME_PERCENTAGE
MODIFIER_PROPERTY_RESPAWNTIME_STACKING
MODIFIER_PROPERTY_STATS_AGILITY_BONUS
MODIFIER_PROPERTY_STATS_INTELLECT_BONUS
MODIFIER_PROPERTY_STATS_STRENGTH_BONUS
MODIFIER_PROPERTY_TOOLTIP
MODIFIER_PROPERTY_TOTAL_CONSTANT_BLOCK
MODIFIER_PROPERTY_TOTAL_CONSTANT_BLOCK_UNAVOIDABLE_PRE_ARMOR
MODIFIER_PROPERTY_TOTALDAMAGEOUTGOING_PERCENTAGE
MODIFIER_PROPERTY_TRANSLATE_ACTIVITY_MODIFIERS
MODIFIER_PROPERTY_TRANSLATE_ATTACK_SOUND
MODIFIER_PROPERTY_TURN_RATE_PERCENTAGE

Modifier 状态

Modifier状态和Modifier属性十分类似,只不过他们是只有三个数值:"MODIFIER_STATE_VALUE_NO_ACTION", "MODIFIER_STATE_VALUE_ENABLED" 或者 "MODIFIER_STATE_VALUE_DISABLED"。以下的modifier示例给单位添加了一个简单的眩晕粒子特效,覆盖了单位的模型动作,让单位进入了眩晕状态。

"creature_bash_ministun"
{
 "Duration" "%duration"
 "EffectName" "generic_stunned"
 "EffectAttachType" "follow_overhead"
 "Duration"  "%stun_duration"
 "OverrideAnimation" "ACT_DOTA_DISABLED"
 "States"
 {
   "MODIFIER_STATE_STUNNED" "MODIFIER_STATE_VALUE_ENABLED"
 }			
}


以下是可以使用的Modifier状态:

MODIFIER_STATE_ATTACK_IMMUNE
MODIFIER_STATE_BLIND
MODIFIER_STATE_BLOCK_DISABLED
MODIFIER_STATE_CANNOT_MISS
MODIFIER_STATE_COMMAND_RESTRICTED
MODIFIER_STATE_DISARMED
MODIFIER_STATE_DOMINATED
MODIFIER_STATE_EVADE_DISABLED
MODIFIER_STATE_FLYING
MODIFIER_STATE_FROZEN
MODIFIER_STATE_HEXED
MODIFIER_STATE_INVISIBLE
MODIFIER_STATE_INVULNERABLE
MODIFIER_STATE_LOW_ATTACK_PRIORITY
MODIFIER_STATE_MAGIC_IMMUNE
MODIFIER_STATE_MUTED
MODIFIER_STATE_NIGHTMARED
MODIFIER_STATE_NO_HEALTH_BAR
MODIFIER_STATE_NO_TEAM_MOVE_TO
MODIFIER_STATE_NO_TEAM_SELECT
MODIFIER_STATE_NOT_ON_MINIMAP
MODIFIER_STATE_NOT_ON_MINIMAP_FOR_ENEMIES
MODIFIER_STATE_NO_UNIT_COLLISION
MODIFIER_STATE_OUT_OF_GAME
MODIFIER_STATE_PASSIVES_DISABLED
MODIFIER_STATE_PROVIDES_VISION
MODIFIER_STATE_ROOTED
MODIFIER_STATE_SILENCED
MODIFIER_STATE_SOFT_DISARMED
MODIFIER_STATE_SPECIALLY_DENIABLE
MODIFIER_STATE_STUNNED
MODIFIER_STATE_UNSELECTABLE

Modifier 事件

以下是可以使用的Modifier事件:

MODIFIER_EVENT_ON_ABILITY_END_CHANNEL
MODIFIER_EVENT_ON_ABILITY_EXECUTED
MODIFIER_EVENT_ON_ABILITY_START
MODIFIER_EVENT_ON_ATTACK
MODIFIER_EVENT_ON_ATTACK_ALLIED
MODIFIER_EVENT_ON_ATTACKED
MODIFIER_EVENT_ON_ATTACK_FAIL
MODIFIER_EVENT_ON_ATTACK_LANDED
MODIFIER_EVENT_ON_ATTACK_START
MODIFIER_EVENT_ON_BREAK_INVISIBILITY
MODIFIER_EVENT_ON_DEATH
MODIFIER_EVENT_ON_HEAL_RECEIVED
MODIFIER_EVENT_ON_HEALTH_GAINED
MODIFIER_EVENT_ON_HERO_KILLED
MODIFIER_EVENT_ON_MANA_GAINED
MODIFIER_EVENT_ON_ORB_EFFECT
MODIFIER_EVENT_ON_ORDER
MODIFIER_EVENT_ON_PROCESS_UPGRADE
MODIFIER_EVENT_ON_PROJECTILE_DODGE
MODIFIER_EVENT_ON_REFRESH
MODIFIER_EVENT_ON_RESPAWN
MODIFIER_EVENT_ON_SPENT_MANA
MODIFIER_EVENT_ON_STATE_CHANGED
MODIFIER_EVENT_ON_TAKEDAMAGE
MODIFIER_EVENT_ON_TAKEDAMAGE_REAPERSCYTHE
MODIFIER_EVENT_ON_TELEPORTED
MODIFIER_EVENT_ON_TELEPORTING
MODIFIER_EVENT_ON_UNIT_MOVED

Modifiers也可以定义一些触发事件,以下的这些事件能够在modifier中定义 - 动作在本页面其他位置已经提及了时

OnAttacked - 当拥有modifier的单位被攻击时
OnAttackLanded - 当拥有modifier的单位攻击到某个目标时
OnAttackStart -当拥有modifier的单位开始攻击某个目标
OnCreated -当modifier被创建时
OnDealDamage - 当拥有modifier的单位施加伤害的时候
OnDeath - 当拥有modifier的单位死亡的时候
OnDestroy - 当这个modifier被移除的时候
OnOrbFire - 当法球modifier的法球被释放的时候
OnOrbImpact - 当法球modifier的法球命中目标之后
OnTakeDamage - 当拥有modifier的单位受到伤害的时候
Orb - 定义一个法球modifeir的特效等

一个更复杂的例子

本示例在技能被添加之后,将会等到拥有者死亡之后触发,当拥有者死亡的时候,一个带有酸雾特效和一个降低目标区域的单位护甲并施加伤害的计时器将会被创建。

//=================================================================================================================
// Creature: Acid Spray
//=================================================================================================================
"creature_acid_spray"
{
 // General
 //-------------------------------------------------------------------------------------------------------------
 "BaseClass" 					"ability_datadriven"
 "AbilityBehavior"				"DOTA_ABILITY_BEHAVIOR_AOE"
 "AbilityUnitDamageType"			"DAMAGE_TYPE_COMPOSITE"
 "AbilityTextureName"			"alchemist_acid_spray"
 // Casting
 //-------------------------------------------------------------------------------------------------------------
 "AbilityCastPoint"				"0.2"
 "AbilityCastRange"				"900"
 "OnOwnerDied"
 {
   "CreateThinker"
   {
    "ModifierName" "creature_acid_spray_thinker"
    "Target" "CASTER"
   }
 }
 "Modifiers"
 {
  "creature_acid_spray_thinker"
  {
   "Aura" "create_acid_spray_armor_reduction_aura"
   "Aura_Radius" "%radius"
   "Aura_Teams" "DOTA_UNIT_TARGET_TEAM_ENEMY"
   "Aura_Types" "DOTA_UNIT_TARGET_HERO | DOTA_UNIT_TARGET_CREEP | DOTA_UNIT_TARGET_MECHANICAL"
   "Aura_Flags" "DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES"
   "Duration" "%duration"
   "OnCreated"
   {
    "AttachEffect"
    {
      "EffectName" "alchemist_acid_spray"
      "EffectAttachType" "follow_origin"
      "Target" "TARGET"
      "ControlPoints"
      {
       "00" "0 0 0"
       "01" "%radius 1 1"
      }
     }
    }
   }
   "create_acid_spray_armor_reduction_aura"
   {
    "IsDebuff" "1"
    "IsPurgable" "0"
    "EffectName" "alchemist_acid_spray_debuff"				
    "ThinkInterval" "%tick_rate"
    "OnIntervalThink"
    {
      "Damage"
      {
       "Type" "DAMAGE_TYPE_COMPOSITE"
       "Damage" "%damage"
       "Target" "TARGET"
      }
     }
     "Properties"
     {
       "MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS" "%armor_reduction"
     }
    }
   }
 // Special	
 //-------------------------------------------------------------------------------------------------------------
 "AbilitySpecial"
 {
  "01"
  {
   "var_type"				"FIELD_INTEGER"
   "radius"				"250"
  }
  "02"
  {
   "var_type"				"FIELD_FLOAT"
   "duration"				"16.0"
  }
  "03"
  {
   "var_type"				"FIELD_INTEGER"
   "damage"				"118 128 138 158"
  }
  "04"
  {
   "var_type"				"FIELD_INTEGER"
   "armor_reduction"		        "-3 -4 -5 -6"
  }
  "05"
  {
   "var_type"				"FIELD_FLOAT"
   "tick_rate"				"1.0"
  }
 }
}