Scripting summon ability.
Hello, I've been trying to make a skill that works kinda like Lycan's wolves (with the "twist" being that you can click the point you want the units to be summoned at + his ultimate also spawns current level of this ability) and I can't really find any way to do the "leveling" summons with datadriven ability so I'm trying out lua for that.
Now, there's a convenient way of doing that with CreateUnitByName but I'm not entirely sure if I'm giving it proper arguments. I currently have something like this:
http://pastebin.com/1Ki8RjFC (the wolf was just for testing whether only the script or whole ability was going to bug)
The skill works fine, summons an unit at the target point, but it's uncontrollable. It's friendly and aggros to nearby enemies, can't seem to give the unit's ownership to the caster. I assume it's something with two handle arguments in CreateUnitByName which I have no idea how to use properly. I would appreciate some help.
Also Svenocopter picture for lols: http://i.imgur.com/M7n2Buo.jpg
Posted Aug 13, 2014, 3:50 AM UTC
after you create the unit you have to set it to be controllable by somoene with SetControllableByPlayer()
example how i did it with my summon
local fireelemental = CreateUnitByName("elementalist_fire_elemental", target, true, player, caster, team)
fireelemental:SetControllableByPlayer(caster:GetPlayerID(), true)
Thanks, this worked just as I needed it to work. Seems pretty weird they made it such way tbh :D