数据驱动类技能范例
From Valve Developer Community
< Dota 2 创意工坊工具集 | 脚本编写
Contents[hide] |
单位死亡后造成持续性范围伤害的例子
本示例在技能被添加之后,将会等到拥有者死亡之后触发,当拥有者死亡的时候,一个带有酸雾特效和一个降低目标区域的单位护甲并施加伤害的计时器将会被创建。
//================================================================================================================= // 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" } } }
一个法球的实例
一个可以造成范围性伤害和晕眩的法球实例。
"testOrb_Example" { "ID" "10003" "BaseClass" "ability_datadriven" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_UNIT_TARGET | DOTA_ABILITY_BEHAVIOR_AUTOCAST| DOTA_ABILITY_BEHAVIOR_ATTACK" "AbilityUnitTargetTeam" "DOTA_UNIT_TARGET_TEAM_ENEMY" "AbilityUnitTargetType" "DOTA_UNIT_TARGET_ALL" "MaxLevel" "1" "AbilityCastPoint" "0.0" "AbilityCastRange" "900" "AbilityCooldown" "0" "AbilityManaCost" "10" "AbilitySpecial" { "01" { "var_type" "FIELD_INTEGER" "RangeDamage" "75" } } "Modifiers" { "TestOrb_Modifier" { "Passive" "1" "IsHidden" "1" "Orb" { "Priority" "DOTA_ORB_PRIORITY_ABILITY"//法球的类型 //下面是一个投射物特效的定义,值得一提的是,不少粒子效果是无法形成正常的投射物效果,而是会直接附着到目标上面播放。 "ProjectileName" "particles/units/heroes/hero_sven/sven_spell_storm_bolt.vpcf" "CastAttack" "1" } "OnOrbFire" { //这下面的设定会使得当你右键激活自动释放时进行普通攻击也能正常消耗魔法,否则激活自动释放状态下不会消耗魔法。 "SpendMana" { "Mana" "%AbilityManaCost" } } "OnOrbImpact" { "FireEffect" { "EffectName" "particles/units/heroes/hero_sven/sven_spell_warcry.vpcf" "EffectAttachType" "attach_hitloc" "Target" "TARGET" } "Damage"//对范围内单位造成伤害 { "Type" "DAMAGE_TYPE_PURE" "Damage" "%RangeDamage"//和AbilitySpecial里定义的RangeDamage上对应数值挂钩。 "Target" { "Center" "TARGET" "Teams" "DOTA_UNIT_TARGET_TEAM_ENEMY" "Type" "DOTA_UNIT_TARGET_ALL" "Radius" "275" } } "Stun"//击晕范围内单位 { "Duration" "2" "Target" { "Center" "TARGET" "Teams" "DOTA_UNIT_TARGET_TEAM_ENEMY" "Type" "DOTA_UNIT_TARGET_ALL" "Radius" "275" } } } } } }
系统光环实例
一个普通的系统光环实现,效果是范围内敌军减少50%攻击力。
"TestSysAura" { "BaseClass" "ability_datadriven" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_AURA | DOTA_ABILITY_BEHAVIOR_PASSIVE" "AbilityUnitTargetTeam" "DOTA_UNIT_TARGET_TEAM_ENEMY" "AbilityUnitTargetType" "DOTA_UNIT_TARGET_ALL" "AbilityTextureName" "alchemist_acid_spray" "MaxLevel" "1" "AbilityCastPoint" "0.0" "AbilityCastRange" "500" "AbilityCooldown" "0" "AbilityManaCost" "0" "AbilitySpecial" { "01" { "var_type" "FIELD_INTEGER" "Range" "500" } } "Modifiers" { "TestSysAura_Modifier" { "Passive" "1" "IsHidden" "1" "Aura" "TestSysAura_FixAttackPercent" "Aura_Radius" "%Range" "Aura_Teams" "DOTA_UNIT_TARGET_TEAM_ENEMY" "Aura_Types" "DOTA_UNIT_TARGET_ALL" } "TestSysAura_FixAttackPercent" { "IsDebuff" "1" "IsPurgable" "0" "Properties" { "MODIFIER_PROPERTY_DAMAGEOUTGOING_PERCENTAGE" "-50" } } } }
一个自定义的光环实例
这个光环的效果和上面那个光环的效果一样。 但是通过这个我们可以在lua中得到光环的拥有者和作用单位。于是可以在lua里面对这些实体进行各种额外的操作。
//在lua中我们可以获取到一下entity // 光环拥有者 -> EntIndexToHScript(keys.caster_entindex) // 被光环作用的单位 -> keys.target "TestCustomAura" { "BaseClass" "ability_datadriven" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_AURA | DOTA_ABILITY_BEHAVIOR_PASSIVE" "AbilityUnitTargetTeam" "DOTA_UNIT_TARGET_TEAM_ENEMY" "AbilityUnitTargetType" "DOTA_UNIT_TARGET_ALL" "AbilityTextureName" "alchemist_acid_spray" "MaxLevel" "1" "AbilityCastPoint" "0.0" "AbilityCastRange" "500" "AbilityCooldown" "0" "AbilityManaCost" "0" "AbilitySpecial" { "01" { "var_type" "FIELD_INTEGER" "Range" "500" } } "Modifiers" { "TestCustomAura_Modifier" { "Passive" "1" "IsHidden" "1" "ThinkInterval" "0.5" "OnIntervalThink" { "ApplyModifier" { "ModifierName" "TestCustomAura_FixAttackPercentIcon" "Target" { "Teams" "DOTA_UNIT_TARGET_TEAM_ENEMY" "Types" "DOTA_UNIT_TARGET_ALL" "Center" "CASTER" "Radius" "%Range" } } "ApplyModifier" { "ModifierName" "TestCustomAura_FixAttackPercentTimer" "Target" { "Teams" "DOTA_UNIT_TARGET_TEAM_ENEMY" "Types" "DOTA_UNIT_TARGET_ALL" "Center" "CASTER" "Radius" "%Range" } } } } "TestCustomAura_FixAttackPercentIcon" { "IsDebuff" "1" "IsPurgable" "0" "TextureName" "alchemist_acid_spray" "Properties" { "MODIFIER_PROPERTY_DAMAGEOUTGOING_PERCENTAGE" "-50" } } "TestCustomAura_FixAttackPercentTimer" { "IsDebuff" "1" "IsPurgable" "0" "IsHidden" "1" "Duration" "0.6" "OnDestroy" { "RemoveModifier" { "ModifierName" "TestCustomAura_FixAttackPercentIcon" "Target" "TARGET" } } } } }
由AMHC团队汉化 | 汉化问题反馈