Advertisement
Guest User

Untitled

a guest
Sep 1st, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. NUMBERTOSPAWN = 1 --How many to spawn
  2. SPAWNLOCATION = "path_customspawn"
  3. WAYPOINTNAME = "path_test_1"
  4.  
  5. if customSpawn == nil then
  6.         customSpawn = class({})
  7. end
  8.  
  9. function Precache( context )
  10.         --Cache the Gnoll Assassin model
  11.         PrecacheUnitByNameSync( "npc_dota_npc_base", context )
  12.         PrecacheModel( "npc_dota_npc_base", context )
  13. end
  14.  
  15. function customSpawn:spawnunits()
  16.         local spawnLocation = Entities:FindByName( nil, SPAWNLOCATION )
  17.         local waypointlocation = Entities:FindByName ( nil, WAYPOINTNAME)
  18.         local i = 1
  19.         while NUMBERTOSPAWN>=i do
  20.                 --hscript CreateUnitByName( string name, vector origin, bool findOpenSpot, hscript, hscript, int team)
  21.                 local creature = CreateUnitByName( "npc_dota_npc_base" , spawnLocation:GetAbsOrigin() + RandomVector( RandomFloat( 0, 200 ) ), true, nil, nil, DOTA_TEAM_BADGUYS )
  22.                 print ("create unit has run")
  23.                 --Sets the waypath to follow. path_wp1 in this example
  24.                 creature:SetInitialGoalEntity( waypointlocation )
  25.                 i = i + 1
  26.         end
  27.  
  28. end    
  29.  
  30. function Activate()
  31.     GameRules.customSpawn = customSpawn()
  32.     GameRules.customSpawn:InitGameMode()
  33.  
  34.  
  35. end
  36.  
  37. function customSpawn:InitGameMode()
  38.         self.spawnunits()
  39.  
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement