• Squad NPC STool (with "Precision" placement)
    34 replies, posted
  • Avatar of BassPwnsYou
  • 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. [B]Known Problems[/B] 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. [B]Cool things to try![/B] 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.) [I]EDIT (9/3/2010): Added offset sliders.[/I] [B] Subversion[/B] (Already improved from the garrysmod.org version): [URL]http://squadnpcs.googlecode.com/svn/trunk/[/URL] [B] Version 0.9[/B]: [URL]http://www.garrysmod.org/downloads/?a=view&id=109234[/URL] [B]If you're confused, read the readme first. It probably answers the question you want to ask.[/B]
  • Avatar of Echo225
  • I used to bind a key to set the Combine to squads, now I can just use a tool. Thank you so much!!
  • Avatar of Kung Fu Jew
  • [QUOTE=BassPwnsYou;24534181]Spawn Breen at precisely 275 degrees aligned to world for your next "KILL BREEN" save file.[/QUOTE] What does this mean? Anyway I love this STool so much. Lifesaver.
  • Avatar of BassPwnsYou
  • 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.
  • Avatar of Flubadoo
  • 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?
  • Avatar of BassPwnsYou
  • 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.
  • Avatar of Flubadoo
  • 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?
  • Avatar of Kung Fu Jew
  • [QUOTE=superstepa;24539451]Looks cool , but with Advanced AI I dont need it . Npcs get in a squad themselves[/QUOTE] No they don't [editline]03:45AM[/editline] Also if you wanna fix NPCs spawning in the ground, allow us to set an offset height.
  • Avatar of BassPwnsYou
  • [QUOTE=Kung Fu Jew;24562456]No they don't [editline]03:45AM[/editline] Also if you wanna fix NPCs spawning in the ground, allow us to set an offset height.[/QUOTE] 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. [QUOTE=Flubadoo]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?[/QUOTE] 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.
  • Avatar of Flubadoo
  • [QUOTE=BassPwnsYou;24565264] allow random patrolling to give a little more depth.[/QUOTE] I thought combines sometimes already did that? I recall that they do it, but somewhat randomly.
  • Avatar of BassPwnsYou
  • [QUOTE=Flubadoo;24571593]I thought combines sometimes already did that? I recall that they do it, but somewhat randomly.[/QUOTE] They stumble around after killing all hostiles, but I was thinking something grander. EDIT: Added SVN link to the first post.
  • Avatar of Sunnday3
  • You should make it so we spawn the npcs with custom npc weapons we have installed.
  • Avatar of bloodien0se
  • Hmm, I'm getting some odd errors, and strange AI Behavior [CODE]Can't find factory for entity: npc_cscanner weapons\gmod_tool\stools\squadnpcs.lua:134: Tried to use a NULL entity! [/CODE] 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.
  • Avatar of Flubadoo
  • Grander, as in, new animations or patrolling around the whole place? [editline]09:18AM[/editline] [QUOTE=Sunnday3;24575297]You should make it so we spawn the npcs with custom npc weapons we have installed.[/QUOTE] You can go edit the place where it says wpn[] or something and add in your own using that example. [editline]09:26AM[/editline] Can you devise some way to let us add ourr own weapons without disrupting the lua? Since editing it means that the svn won't update correctly.
  • Avatar of BassPwnsYou
  • I've already got a method setup for using the default list of NPC weapons. At the same time I'm working on taking the regular list of NPCs from the spawn menu, which is why I haven't released it to the SVN yet. EDIT: Do you own half-life 2? Try typing ent_create npc_cscanner into the console. If it works there's a bug, if not you don't have the content installed. If the game hangs for a while, then it works try using the tool again. (Gmod will download content from games you own as needed.) EDIT EDIT: Revision 7 of the SVN is up, I don't have any custom NPC weapons, so could someone confirm that they appear in the spawnlist? Current known problems include not being able to select no weapon. In the interim you can type squadnpcs_weapon weapon_none into the console to get around it.
  • Avatar of bloodien0se
  • I don't know what was causing my console errors before, but it had to do with my dedicated server I was running. It works in single player, I've yet to add it back to my server to check it out. It would be neat to add this functionality to an NPC Spawning Platform such as [url="http://www.garrysmod.org/downloads/?a=view&id=3898"]this one[/url]
  • Avatar of BassPwnsYou
  • [QUOTE=bloodien0se;24605550]I don't know what was causing my console errors before, but it had to do with my dedicated server I was running. It works in single player, I've yet to add it back to my server to check it out. It would be neat to add this functionality to an NPC Spawning Platform such as [URL="http://www.garrysmod.org/downloads/?a=view&id=3898"]this one[/URL][/QUOTE] I definitely could do that, I don't think it would take more than a couple of minutes, but I'd feel bad ripping off some poor guy's code and redist. with my five minutes of work. Maybe I'll do it anyway.
  • Avatar of Aspirin
  • I'm awaiting the custom NPC weapons update very patiently. Keep up the good work!
  • Avatar of Flubadoo
  • Assigning npc that are not on the list are buggy. It only works half the time for npc_citizens with different models (5 second npcs) and works even less with SNPCs (HL:R npcs, Dans).
  • Avatar of BassPwnsYou
  • [QUOTE=Flubadoo;24613536]Assigning npc that are not on the list are buggy. It only works half the time for npc_citizens with different models (5 second npcs) and works even less with SNPCs (HL:R npcs, Dans).[/QUOTE] All types of citizen are already in the NPC list.
  • Avatar of Flubadoo
  • No, I mean things like this: [url=http://www.garrysmod.org/downloads/?a=view&id=77839][img]http://www.garrysmod.org/img/?t=dll&id=77839[/img][/url] It uses npc_citizen as the class, but it almost never works correctly when its assigned a squad using right click.
  • Avatar of BassPwnsYou
  • [QUOTE=Flubadoo;24646017]No, I mean things like this: [URL="http://www.garrysmod.org/downloads/?a=view&id=77839"][IMG]http://www.garrysmod.org/img/?t=dll&id=77839[/IMG][/URL] It uses npc_citizen as the class, but it almost never works correctly when its assigned a squad using right click.[/QUOTE] Right click doesn't work like it's intended to just yet. While technically speaking it works, it doesn't seem to change the behavior of NPCs that were created without the squad being set first. I'm working on it.