does anyone know why is this not working, ability work normaly and cast this script...

Does anyone know why this abilty wont spawn units, It does not show any errors problem is somewhere here...

function spawn( keys )

local caster = keys.caster

local spellName = keys.SpellName

Timers:CreateTimer(5, function() if caster:HasAbility(spawner7) then local unit = CreateUnitByName("miligun", position, true, caster , caster , caster:GetTeamNumber()) end return 1.0
end) end


  • Posts: 167

    you must be getting errors with that code. spawner7 is undefined, it needs to be a string.


    position is also undefined.

    you should really read the tutorials

  • edited January 9 Posts: 4

    I read that many times look:

    function spfootman( event )

    local target =
    local spellName = event.SpellName
    local repeat_interval = 2 -- Rerun this timer every *repeat_interval* game-time seconds
    local start_after = 1 -- Start this timer *start_after* game-time seconds later
        --if    target:HasAbility(spellName) then
        Timers:CreateTimer(start_after, function()
        return repeat_interval


    function SpawnCreeps()
        local point = Entities:FindByName( nil, "spawner22"):GetAbsOrigin()
        local unit = CreateUnitByName("footman", point, true, nil, nil, DOTA_TEAM_NEUTRALS)

    this is working normaly, but if i remove '--' on 'if' and 'end' as u can see then it wont work and yeah i did define ability ;


    { "ScriptFile" "spawn_footman.lua" "Function" "spfootman" "SpellName" "spawn_footman" }