Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 creature = CreateUnitByName( "npc_dota_npc_base" , spawnLocation:GetAbsOrigin() + RandomVector( RandomFloat( 0, 200 ) ), true, nil, nil, DOTA_TEAM_NEUTRALS )
- print ("create unit has run")
- creature:SetInitialGoalEntity( waypointlocation )
- end
- function Activate()
- GameRules.customSpawn = customSpawn()
- GameRules.customSpawn:InitGameMode()
- --thisEntity:SetContextThink("customSpawn:spawnunits", spawnunits, 5)
- end
- function customSpawn:InitGameMode()
- self.spawnunits()
- ListenToGameEvent("entity_killed", Dynamic_Wrap(customSpawn, 'ourcreepskilled'), self)
- print ("Listen To GameEvent Fired Entity Got Killed Now")
- end
- function customSpawn:ourcreepskilled( keys )
- local unit = EntIndexToHScript( keys.entindex_killed )
- if string.find(unit:GetUnitName(),"npc_dota_npc_base") then
- print ("We found NPC_DoTA_NPC_BASE GOT KILLED LETS CALL SPAWNUNITS FUNCTION")
- return customSpawn:spawnunits()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement