#how can i create an unit by Lua script

1 messages · Page 1 of 1 (latest)

pale spindle
#

CreateUnitByName

vagrant sailBOT
#

Found 2 functions for createunitbyname

🇸 CreateUnitByName(unitName: string, location: Vector, findClearSpace: bool, npcOwner: CBaseEntity|nil, entityOwner: CBaseEntity|nil, team: DOTATeam_t): CDOTA_BaseNPC
Creates a unit by its dota_npc_units.txt name.
The spawned unit will not be controllable by default. You can use unit.SetControllableByPlayer() to change this.
Warning: mass synchronous unit spawning may be slow. Prefer CreateUnitByNameAsync unless synchronous access is required.
🇸 CreateUnitByNameAsync(unitName: string, location: Vector, findClearSpace: bool, npcOwner: CBaseEntity|nil, entityOwner: CBaseEntity|nil, team: DOTATeam_t, callback: (unit: CDOTA_BaseNPC) → nil): SpawnGroupHandle
Creates a unit by its dota_npc_units.txt name.
The spawned unit will not be controllable by default. You can use unit.SetControllableByPlayer() to change this.