Garry's Mod

Garry's Mod

Garry's Mod Stranded
Polar 9 Jan, 2017 @ 8:49pm
Custom Spawnable NPCS
I've seen servers with custom npcs that roam during the day. How would I go around adding something like that?

I see the lists for lootable NPCS -
GMS.LootableNPCs = { "npc_antlion", "npc_antlionguard", "npc_crow", "npc_seagull", "npc_pigeon", "npc_zombie" }

But I for some reason cannot find where you call to have zombies spawn. Any help?

EDIT:

Okay, so i found where zombies get spawned but the zombies are spawned based on the time of day and then roam to find enemies right?

for i = 0, math.random( 2, 6 ) do local zombies = #ents.FindByClass( "npc_zombie" ) local fzombies = #ents.FindByClass( "npc_fastzombie" ) if ( zombies + fzombies > 14 ) then break end local pos = Vector( math.random( -6000, 6000 ), math.random( -6000, 6000 ), 1800 ) local tr = util.TraceLine( { start = pos, endpos = pos - Vector( 0, 0, 9999 ) } ) if ( tr.HitWorld ) then local class = "npc_zombie" if ( math.random( 0, 100 ) < 25 ) then class = "npc_fastzombie" end local zombie = ents.Create( class ) zombie:SetPos( tr.HitPos + Vector( 0, 0, 64 ) ) zombie:SetHealth( 128 ) zombie:SetNWString( "Owner", "World" ) zombie:SetKeyValue( "spawnflags", "1280" ) zombie:Spawn() zombie:Fire( "Wake" ) zombie:Activate()


Last edited by Polar; 9 Jan, 2017 @ 8:55pm
< >
Showing 1-2 of 2 comments
LowTierAether 25 Mar, 2017 @ 8:18am 
i dont know.
psychicweaver 4 Jul, 2017 @ 12:19pm 
Originally posted by Meet The Amazing Sonic:
i dont know.

the literally ♥♥♥♥ off
< >
Showing 1-2 of 2 comments
Per page: 1530 50