Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NUMBERTOSPAWN = 1 --How many to spawn
- SPAWNLOCATION = "path_customspawn"
- WAYPOINTNAME = "path_test_1"
- if customSpawn == nil then
- customSpawn = class({})
- end
- function Precache( context )
- --Cache the Gnoll Assassin model
- PrecacheUnitByNameSync( "npc_dota_npc_base", context )
- PrecacheModel( "npc_dota_npc_base", context )
- end
- function customSpawn:spawnunits()
- local spawnLocation = Entities:FindByName( nil, SPAWNLOCATION )
- local waypointlocation = Entities:FindByName ( nil, WAYPOINTNAME)
- local i = 1
- while NUMBERTOSPAWN>=i do
- --hscript CreateUnitByName( string name, vector origin, bool findOpenSpot, hscript, hscript, int team)
- local creature = CreateUnitByName( "npc_dota_npc_base" , spawnLocation:GetAbsOrigin() + RandomVector( RandomFloat( 0, 200 ) ), true, nil, nil, DOTA_TEAM_BADGUYS )
- print ("create unit has run")
- --Sets the waypath to follow. path_wp1 in this example
- creature:SetInitialGoalEntity( waypointlocation )
- i = i + 1
- end
- end
- function Activate()
- GameRules.customSpawn = customSpawn()
- GameRules.customSpawn:InitGameMode()
- end
- function customSpawn:InitGameMode()
- self.spawnunits()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement