CreateUnitByName, create it to caster who sstart ability...

edited January 9 in Questions

So there is ability which start script and now how to do that spawned units spawn near hero, this point need be set somehow...

local point = ???????????????????????????????

local unit = CreateUnitByName("footman", point, true, nil, nil, DOTA_TEAM_NEUTRALS)

Comments

  • Point is Vector object. You can get it from caster entity local caster = self:GetCaster() local point = caster:GetAbsOrigin() or create new Vector(x, y, z)

  • edited January 12 Posts: 4

    function spfootman( keys ) local caster = keys.caster local radius = keys.radius local spellName = keys.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  caster:HasAbility(spellName) then
        Timers:CreateTimer(start_after, function()
        SpawnCreeps()
        return repeat_interval
    end)
    

    end end

    function SpawnCreeps()
        local caster = self:GetCaster()
        local point = caster:GetAbsOrigin()
        local unit = CreateUnitByName("footman", point, true, nil, nil, DOTA_TEAM_NEUTRALS)
    end