DataDriven ability can't trigger linken's sphere

I add a modifier_item_sphere_target to a unit.
But my unit-target ability cant trigger the sphere.

If I add "TriggerSpellAbsorb" in lua , everythings fine.
I dont want to add "TriggerSpellAbsorb" to all my unit-target ability.
How should I do?

In this thread: https://moddota.com/forums/discussion/1537/let-s-discuss-how-liken-s-sphere-works
**"Datadriven abilities with unit target do this automatically" **
that seems wrong?

Comments

  • Posts: 125

    You can try to do it in order filter.

  • Posts: 19

    @Yunten
    Can order filter absorb spell? I know order filter can stop casting ability, but how to absorb spell? ()

  • Posts: 271

    I dont want to add "TriggerSpellAbsorb" to all my unit-target ability.

    I think that's the best way, even if you don't want to do it.

    Order filter sounds really messy to me. Doesn't include:

    i) triggering linkens upon projectile impact

    ii) removing one linkens buff when you have more of them on your hero

    iii) lotus interaction

    So you need this code:

    local target = event.target
    local ability = event.ability
    if not target:TriggerSpellAbsorb(ability) then
       -- print("Target doesn't have Spell Block.")
       -- what your spell does when target doesn't have spell block
    end
    

    inside every function you call in datadriven unit-target ability.

    1) If your ability should trigger linkens or lotus instantly when you click on the target:

    "OnSpellStart"
    {
       "RunScript"
       {
         "ScriptFile"            "path_to_your_lua_file_of_ability_1/ability_1.lua"
         "Function"              "Ability1Start"
       }
    }
    

    ability_1.lua:

    function Ability1Start(event)
       local target = event.target
       local caster = event.caster
       local ability = event.ability
       if not target:TriggerSpellAbsorb(ability) then
          -- print("Target doesn't have Spell Block.")
          -- what your spell does when target doesn't have spell block
          -- if your spell is mostly datadriven you usually just need something like this:
          ability:ApplyDataDrivenModifier(caster, target, "modifier_custom_ability_debuff", {["duration"] = hero_duration})
       end
    

    2) If your ability should trigger linkens or lotus on projectile impact:

    "OnSpellStart"
    {
       "TrackingProjectile"
       {
          "Target"            "TARGET"
          "EffectName"  "projectile_particle_name.vpcf"
          "Dodgeable"         "1"
          "ProvidesVision"    "1"
          "VisionRadius"      "400"
          "MoveSpeed"         "900"
          "SourceAttachment"  "DOTA_PROJECTILE_ATTACHMENT_ATTACK_1"
       }     
    }
    
    "OnProjectileHitUnit"
    {
       "DeleteOnHit"   "1"
       "RunScript"
       {
          "ScriptFile"    "path_to_your_lua_file_of_ability_2/ability_2.lua"
          "Function"      "Ability2Start"
       }                     
    }
    
  • Posts: 19

    @Darkonius
    Thank you !