Datadriven Help Again

Hey i need help again how would i make a datadriven ability that did more damage the more strength you got?. Like pudges ult or centaurs Double edge.

Comments

  • Why make a datadriven ability? This method is kinda outdated, pure lua will work much better. For that you just use following piece as example: ~~~lua my_ability = class({})

    function my_ability:OnSpellStart() local caster = self:GetCaster() local target = self:GetCursorTarget() -- target is only aquireable if ability has DOTA_ABILITY_BEHAVIOR_UNIT_TARGET in ability behavior

    local caster_str = caster:GetStrength() -- getting strength of caster, this may also be GetAgility() and GetIntellect()
    
    local base_damage       = self:GetSpecialValueFor("base_damage") -- value defined in "AbilitySpecial" block of ability config
    local str_multiplier    = self:GetSpecialValueFor("str_multiplier") -- same as previous value
    
    local total_damage = base_damage + caster_str * str_multiplier -- so here we have base damage plus strength multiplied by some value
    
    local damage_table = {
        attacker = caster,
        victim = target,
        ability = self,
        damage = total_damage,
        damage_type = self:GetAbilityDamageType() -- ability damage type must be defined in config to make this work. May also be just DAMAGE_TYPE_MAGICAL etc
    }
    ApplyDamage(damage_table) 
    

    end ~~~

    You may also put here literally anything yoy want, including AOE search, sounds, particles etc. Check other forum guides for further information!

  • ok thank you :D it just datadriven is a bit easier but this helps :D!! you are awesome