Kafe
Level Design nomad
- Joined
- Apr 26, 2016
- Messages
- 7,752
- Nebulae
- 21,504
For those looking to add an element of danger to their half-life maps, here's a quick and easy solution to getting that included into your map.
Cut to the chase, the download
https://drive.google.com/open?id=1qtOcQmai_WJGoibcW-VPstvsFSgTLIvn
It's a zip file, so unpack this and slap it into your gmod maps folder.
What this is
This is a template for an infinite horde generator, simple as that.More specifically, this template provides mappers with a set of scripts they can place into their map projects in order to slowly spawn a limited number of NPCs with a total of four working spawners
In this pack are two files, a vmf that provides the working scripts and spawns in a demonstration environment.
And a bsp of the map made in advance for you to quickly see the result in-game.
How it works
This is a surprisingly simple setup, here is the most simple version1 - The NPC
The NPC can be of anything you really want to have in the map, in this case we are using a standard zombie, this NPC requires the following to work in this prefab.
- Entity name - Something you can use to reference the npc during scripting, make it something easy to understand
- Target path_corner - Needed for part 3, will tell the zombie to walk to a specific entity when it spawns
- [FLAG]Template NPC - This is vital, setting the zombie as a template keeps the zombie from spawning so it can be utilised as a reference for part 2.
- [FLAG] Long visibility/ shoot - lets the zombie spot you further away, helps to get the zombie moving faster
- [FLAG] Fade corpse - Optimisation benefit as the corpse will fade out of the world a short while after it's death
2 - The NPC_TEMPLATE_MAKER and info_node
These are two different entities. The npc_template_maker is setup to spawn the zombie into the world. This entity needs the following settings to work.
- Entity name - Something you can use to reference the npc_template_maker during scripting, make it something easy to understand
- Start disabled? - Make sure this is set to NO if you do not have anything else setup to activate it, otherwise nothing will spawn from it.
- Name of Template npc - Set this to the entity name you gave ti the zombie, this will ensure that the correct npc spawns into the world.
- [FLAG] Infinite children - overrides the limit placed the 'num of npcs' option, ensuring they zombies can spawn forever
- Frequency - The delay between zombie spawns in seconds, if you want the area to always quickly be overwhelmed, you can set the number low, but if the zombies should very slowly wander into this area, set the frequency higher.
- Max live NPCS - limits how many zombies can be spawned from that source, once the player starts to kill these zombies, the npc_template_maker will slowly replace them again
- [FLAG] Fade corpse - Optimisation benefit as the corpse will fade out of the world a short while after it's death
- [FLAG] Don't spawn while visible - If a player is looking at the npc_template_maker, it will not spawn a zombie until the player goes away, helps to keep players from seeing the zombies randomly appear.
The info_node that is also in this part is placed on the floor bellow the npc_template_maker, it assists with navigation for NPCs after they spawn into the world for the first time.
3 - The path_corner and info_node
The path corner is a very simple entity, you only need the following for it to work.
- Entity name - Something you can use to reference the path_corner during scripting, make it something easy to understand
The info_node placed bellow it will allow the zombie to navigate over to the path_corner, doing this alongside adding other info_nodes in your map means that the zombie can turn corners and go through a variety of paths to reach their destination after spawning, helping to give them more life.
Delayed spawning with logic_auto (optional)
Logic_auto is a entity that can be used to start scripts in a map automatically in specific conditions (such as loading the map)
In this case we can use it to stagger out the initial spawning of zombies in the map, to prevent a group of four zombies instantly appearing in the area.
For this to work, the following needs to be done in advance with existing entities
Here is how the logic_auto's outputs should look like when it is done (barring the specific names and delays of course)
There are some things we can easily explain here before delving into the output list
You will only need ONE output per npc_template_maker.
Now, for each section, here's how to set them up.
In this case we can use it to stagger out the initial spawning of zombies in the map, to prevent a group of four zombies instantly appearing in the area.
For this to work, the following needs to be done in advance with existing entities
- all npc_template_makers need to be disabled by default
Here is how the logic_auto's outputs should look like when it is done (barring the specific names and delays of course)
You will only need ONE output per npc_template_maker.
Now, for each section, here's how to set them up.
- My Output - Set this to OnMapSpawn, this means that the outputs will start when the map loads on singleplayer or on a server.
- Target entity - Set each of these for the npc_template_makers you have, hence why you need to name each entity with something you can easily recognise and remember.
- Target Input - Set this to Enable, doing so will turn the npc_template_makers back on and spawning zombies again as normal.
- Delay - the time it takes for the npc_template_makers to turn back on, you can apply a unique delay for each spawner, which allows you to stagger out the initial zombie spawn, and all following spawns.
The VMF
The VMF included provides an editable version of this setup, allowing you to take the elements you need and applying them to your map where you intended them for use.
I do advice against just dropping these scripts in however, it is strongly recommended that you examine the template first and make adjustments to it in order to better fit your needs.
The BSP
The BSP provides a very basic, greyboxed environment where you can sample the basic version in peace.
Quick warnings
For the love of god, keep the max live NPCs number low (Five is plenty), especially when utilising multiple zombie spawners, letting the spawners constantly add in new NPCs throughout can quickly overwhelm a computer, and increases the stress on a server. (gmod has a habbit of going from fine to 1fps when one entity too many is spawned.)
Reccomendations
I strongly recommend you enable fade corpses
If you include this in a RP map, I strongly suggest including a button of sorts in the map to disables all of these spawners, best placed out of normal player's reach where only staff can reach. Just so those running the server can decide when to utilise this feature to keep danger high, and when to turn it off to lower stress on their server and open a region up for events.
(It is best that npc_template_makers are turned off by default in these cases, so staff do not need to concern themselves with turning them off when the server restarts every time)
Enjoy.
The VMF included provides an editable version of this setup, allowing you to take the elements you need and applying them to your map where you intended them for use.
I do advice against just dropping these scripts in however, it is strongly recommended that you examine the template first and make adjustments to it in order to better fit your needs.
The BSP
The BSP provides a very basic, greyboxed environment where you can sample the basic version in peace.
Quick warnings
For the love of god, keep the max live NPCs number low (Five is plenty), especially when utilising multiple zombie spawners, letting the spawners constantly add in new NPCs throughout can quickly overwhelm a computer, and increases the stress on a server. (gmod has a habbit of going from fine to 1fps when one entity too many is spawned.)
Reccomendations
I strongly recommend you enable fade corpses
If you include this in a RP map, I strongly suggest including a button of sorts in the map to disables all of these spawners, best placed out of normal player's reach where only staff can reach. Just so those running the server can decide when to utilise this feature to keep danger high, and when to turn it off to lower stress on their server and open a region up for events.
(It is best that npc_template_makers are turned off by default in these cases, so staff do not need to concern themselves with turning them off when the server restarts every time)
Enjoy.
Reactions:
List