Want to add 2 ability to my all heroes and set levels.

i want to add 2 ability to my all heroes and set their lvls 1. my code is here what should i write there. Abilities build_tower_basic , build_tower_splash

function GameMode:OnPlayerSpawn(keys)

function GameMode:OnPlayerPickHero(keys)

function GameMode:OnNPCSpawned(keys)
    local npc = EntIndexToHScript(keys.entindex)
    local unit_name = npc:GetUnitName()
    if FX_AMBIENT[unit_name] then
        npc.fx = {}
        npc.fx.ambient = ParticleManager:CreateParticle(FX_AMBIENT[unit_name], PATTACH_ABSORIGIN_FOLLOW, npc)


  • AshAsh
    edited July 2015 Posts: 14

    to create custom abilities to add into your custom game, you need to add your two abilities, to a npc_abilties_custom file in scripts/npc/ folder.

    To set it's level at 1, use

    "MaxLevel"    "1"

    if you want to add these two abilities to all heroes in the current list of dota heroes, you'll have to remove one of the abilities from the slot and then replace it.

    Here's an example:

    local ability = hero:GetAbilityByIndex(1)

    The aforementioned code, replaces the "W" spell for all heroes with the custom ability that you created earlier.