How to make "talent" abilities?

By talent abilities I mean skills that are already there after you select a hero (skills that do not require skill points to level up and are usable at level 1), such as invoker's invoke and techies' flag.


  • Posts: 125

    You can set ability level when hero spawns in "npc_spawned" event.

  • Posts: 48

    Which parts of it have you done so far and which do you need help with?

  • edited July 2016 Posts: 213

    It seems what you're looking for is the RequiredLevel kv flag (see here).

    edit: nevermind I spoke too soon, assuming you want it to be auto skilled it's probably best to go with OnOwnerSpawned in that case

  • Posts: 188

    With lua abilities this is easy. The Intrinsic Modifier is applied when hero gets the skill. This means normal passives have to exclusively tell the modifier not to do anything if the ability level is less than one.

  • Posts: 101

    I have finished the skill. I just need to know how to set the skill level to be 1 when hero spawns.

  • Posts: 101

    I tried

    function my_skill:OnOwnerSpawned()

    It only works when my hero respawns, not the first time it spawns.

  • edited July 2016 Posts: 48

    This might be a bit cumbersome, but it gets the job done anyways.

    Inside YourMod:Init() or something, add a listener

    ListenToGameEvent('npc_spawned', Dynamic_Wrap(YourMod, "OnNPCSpawned"), self)

    Create a method that gets called as soon as something spawns:

    -- Gets called every time a unit spawns.
    function YourMod:OnNPCSpawned(keys)
      local spawnedUnit = EntIndexToHScript(keys.entindex)
      if not spawnedUnit:IsIllusion() and spawnedUnit:IsHero() and not spawnedUnit._initialized then
        -- To make sure this only gets called when the hero spawns for the first time.
        spawnedUnit._initialized = true
  • Posts: 101

    Thanks man, I'll try that.

  • Posts: 132

    Why do you have to loop while you have


    And hey @DrTeaSpoon, i'm a fan of LUA ability, what do you think is better between using GetIntrinsicModifierName and AddModifier ? I care about the upgrade event then what should i use?

  • edited July 2016 Posts: 48

    For some odd reason I hadn't discovered that method... Thanks for the tip.

  • Posts: 5

    Thanks for the tip guys

    Must have dota 2 t shirts

  • Posts: 188

    @lucifekit Depends how you want to use it. If I can make do with single modifier for passive components of ability, I use GetIntrinsicModifierName. For something like werewolf transformation (Overflow Git) I used passive to handle the transform checks and extra modifier for the actual effects of the transformation. I could have done it with single modifier but it seemed more efficient to just apply the new modifier when needed.
    For Talent things. I would just give the ability Intrinsic Modifier with OnCreate function leveling the origin ability to level one if it's less than one.