Squad NPC STool (with "Precision" placement)

I present to you, people of the internet, a STool for spawning NPCs in squads.

I’ll allow you a moment to catch your breath.

Ok, so it’s not that impressive, but the brilliance of it is in the simplicity. Have you ever been screwing around in gm_construct and wished the NPCs were a little more…smart? The AI in the source engine is better than that and all you have to do is assign an NPC a squadname key value and give him some friends to get more tactical actions.

NPCs in squads communicate and coordinate attacks and defense, and will call for help from other squad members or faction members from different squads on the map when engaged by enemies, even if those other NPCs would not normally be in range to engage said threat. This is especially cool with Combine NPCs as they will communicate via radio to report contact and losses. Metropolice are even better, communicating with Overwatch as well.

This STool allows you to place NPCs with the tool gun, meaning you can precisely position them. The default setting will place them facing the same direction as the player, but you can use the Angle Offset slider to rotate the NPC. Setting “Align to World” will ignore player facing direction and align to absolute world angles.

New with version 0.9 are a TON more NPCs including rebels and medics, all types of Combine soldiers and neat Combine goodies, Vortigaunts (who will work with Rebels) and other story NPCs, the ability to align to the world or the player’s view direction and offset from there, and a couple other “goodies.” This is much better than version 0.75 you may have seen on garrysmod.org a few days back.

NPCs I’d still like to get working are striders and combine APCs, but that’s for the 1.0 release. The trouble with striders is that they use air nodes instead of ground nodes to navigate, so they tend to stand around in one place as few maps have air nodes.

Known Problems
NPCs who are assigned a squad name after spawning do not change their behavior. This causes the issue with NPCs like Alyx or Barney who are by default in player_squad and will not attach to another one.
Spawning NPCs on a hill may or may not force them into the ground.

Cool things to try!
Make a Combine Scanner in the same squad as a Combine soldier or metrocop.

Group a few different types of zombies together and scatter them over the map.

Add a vortigaunt or two to your rebel squad.

Add Citizens and their rebel brethren to player_squad.

Spawn Breen at precisely 275 degrees aligned to world for your next “KILL BREEN” save file. (It’s a joke from gmod.org that in retrospect wasn’t that funny.)

EDIT (9/3/2010): Added offset sliders.

** Subversion** (Already improved from the garrysmod.org version):

** Version 0.9**:

If you’re confused, read the readme first. It probably answers the question you want to ask.

I love you.

Thats pretty cool dude. imma try dis out. But seriously. Its cool

You got my download.

Ima get dis

Awesome tool, great for npc battles, here, have a wrench!

I used to bind a key to set the Combine to squads, now I can just use a tool. Thank you so much!!

What does this mean?

Anyway I love this STool so much. Lifesaver.

Looks cool , but with Advanced AI I dont need it . Npcs get in a squad themselves

I would argue Advance AI has an entirely different application. The benefit here is that it doesn’t modify your base NPCs in any way, which means it will never conflict with another addon.

I put one combine squad (a) in the middle of gm_construct and some combine near the edge of the map. When rebels started shooting them, the other combine at the edge of the map didn’t come over to assist the combines. How long is the working distance? Different squads call each other for assistance, or does one squad only call itself?

Did you put the combine in one squad and the the rebels in another? If you put a single combine soldier in a squad he would behave as if he were not in a squad.

Well first, if 5 combines were waiting at the edge of the map. And 5 combines in the same squad were in the middle of the map, would they regroup even if they aren’t in combat?

No they don’t


Also if you wanna fix NPCs spawning in the ground, allow us to set an offset height.

Already working on it, I’ve got a load of new features for the next release, including a new options panel to really get some control over your NPCs.

They won’t group up unless they had been in combat at some point. Otherwise they will just stand around wherever they were spawned. In 1.0 I’m looking to allow random patrolling to give a little more depth.

GLORIOUS! Now if only my tool list was easier to navigate…

I thought combines sometimes already did that? I recall that they do it, but somewhat randomly.

They stumble around after killing all hostiles, but I was thinking something grander.

EDIT: Added SVN link to the first post.

You should make it so we spawn the npcs with custom npc weapons we have installed.

Hmm, I’m getting some odd errors, and strange AI Behavior

Can't find factory for entity: npc_cscanner
weapons\gmod_tool\stools\squadnpcs.lua:134: Tried to use a NULL entity!

About 4 times per spawn. I didn’t spawn any opposing forces on the same team or anything, it did this from the very first spawn. Any idea? Using SVN by the way.