[Mapping resource] NPC zombie hazard creator

I didn't come here to be educated Bastian, just give me the cool zombies.

  • Read the link.

    Votes: 0 0.0%
  • I actually like to learn this crap.

    Votes: 4 100.0%

  • Total voters
    4

Kafe

Level Design nomad
Joined
Apr 26, 2016
Messages
7,737
Nebulae
21,435
S0gI4TE.jpg

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 version
Put1Pho.png

1 - 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.
Other additional settings that may help you are:
  • [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
Other additional settings that may help you are:
  • 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 name of this entity will be used to assign a path_corner to the zombie template, so when they spawn,. they walk over to that location (unless something more interesting appears)

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
  • all npc_template_makers need to be disabled by default
With this done, we can add a logic_auto anywhere in the map and open the output menu in it's properties.
Here is how the logic_auto's outputs should look like when it is done (barring the specific names and delays of course)
pb2Wdt0.png
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.
  • 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.
With that, zombie spawns are staggered​

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.​
 
Reactions: List

Kafe

Level Design nomad
Joined
Apr 26, 2016
Messages
7,737
Nebulae
21,435
wtf was I doing up at 3am on a sunday?
I barely even remember making this thread.
 

Rabid

Rictal-Approved
Joined
Apr 26, 2016
Messages
39,273
Nebulae
109,694
Didn't we have something like this on LP? An NPC spawn creator?
 

Kafe

Level Design nomad
Joined
Apr 26, 2016
Messages
7,737
Nebulae
21,435
Didn't we have something like this on LP? An NPC spawn creator?
I only remember the one utilised on qzrp servers for the NMRiH zombie npcs.
Although, they were just things you dropped into existing maps, and were severely limited as a result. (such as instantly replacing dead npcs, them spawning in full view of everyone, no ability to control which npc spawns in, ect)
 
Reactions: List

Rabid

Rictal-Approved
Joined
Apr 26, 2016
Messages
39,273
Nebulae
109,694
I only remember the one utilised on qzrp servers for the NMRiH zombie npcs.
Although, they were just things you dropped into existing maps, and were severely limited as a result. (such as instantly replacing dead npcs, them spawning in full view of everyone, no ability to control which npc spawns in, ect)
Yeah LP's was the same. I used it in the C8 map change event, p.sure.
 

Kafe

Level Design nomad
Joined
Apr 26, 2016
Messages
7,737
Nebulae
21,435
With hindsight and no longer sleep deprived, I'm certain I can make a much more efficient version of this concept.
I'll be trying some things out, will be back on that shortly.

Update: It's possible, but it's shit.
 
Last edited: