Abilities Data Driven Examples

From Valve Developer Community
Jump to navigation Jump to search

Included here are some examples using the data driven ability system.

AOE Damage Over Time

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.

//=================================================================================================================
// 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"
        }
    }
}

Orb Example

Causes an area of effect stun and damage.

"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"
                    "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"
                    }
                }
            }
        }
    }
}