TFL38’s NPC Spawner

If you liked this item, please rate it up on Steam Workshop page.

Author: TFL38

Last revision: 16 May, 2023 at 21:26 UTC

File size: 22.22 KB

On Steam Workshop

Description:
READ THE DESCRIPTION TO FIND OUT HOW TO USE AND CUSTOMIZE!!!!!
IF YOU’RE LOOKING FOR SOMETHING MORE SIMPLE, USE Zombie/NPC Invasion

(Is it the most optimized and most effective? Not sure, but it worked for my own uses and I figured that I’d make it publicly available too)

Not enough thrill and life in your maps? You want to find monsters hiding in every corner? You want to find some allies? Well I got you covered here!
This addon will spawn NPCs where ever is out of a player’s possible visible view, like behind a wall for example.

AS LONG AS THE MAP EITHER HAS A NAVMESH OR IS FULLY AI NODED!

How to use and customize

It does not spawn NPCs by default as to make it so most maps do not use it (for possible server reasons). In order to make your map spawn NPCs. Go to your addons folder in the Garry’s Mod directory:

Create a folder, name it whatever you want.
Inside the folder, create a folder named "lua".
Inside THAT folder, create another folder but named: "tfl38_npcspawner_map".
And inside that folder, create a txt file, name it after the map you’re targetting ("gm_construct" for example).
set its file type from .txt to .lua

If you want NPCs that’s shared across maps except ones that have a lua file for them. Inside where you’d put the map lua files, create a folder named "shared". and inside it create a lua file named "map_shared".

What the directories should look like:
garrysmod/addons/YOURMODNAME/lua/tfl38_npcspawner_map/MAPNAME.lua
garrysmod/addons/YOURMODNAME/lua/tfl38_npcspawner_map/shared/map_shared.lua

Information regarding what to put inside is here:
Link to documentation[drive.google.com]

Console Variables (the number is the default value):

npcspawner_maxdistance 2000
npcspawner_maxnpcs 50
npcspawner_mindistance 100
npcspawner_rate 0.5 (the rate to spawn the npcs)

Console Commands:

npcspawner_refresh (This’ll reload whatever variables you have set for the map. So you do not have to change map whenever you change the values and configuration for the map.)

It is compatible with ulx as well, with it being admin only by default.

ULX Commands:

ulx npcspawner_distance 100 2000
ulx npcspawner_maxnpcs 50
ulx npcspawner_rate 0.5
ulx npcspawner_refresh