• How to get sweps to appear in the npc weapon tab?
    5 replies, posted
What is the code? :downs:
What do you mean by "NPC Weapon Tab"?
Under the npcs list the weapons you want the npcs to use
You can manually do this with npc_create_equipment weapon_classname, but that's tedious. Here's how you can add SWEPs to the NPC spawn menu. Make a new file in lua/autorun. Name it anything, like newweapons.lua. Open it with notepad, and paste as many instances of this line as you want: [lua]list.Set( "NPCWeapons", "weapon_classname", "DisplayName" )[/lua] You can find the classname of a SWEP by looking in the console after you give it to yourself from the menu. It should say something like: [code]Giving your name a weapon_classname[/code] In garry's CSS SWEPs, the classnames are formatted like weapon_m4, weapon_ak47, weapon_glock, etc. The third parameter, "DisplayName", should be the name that shows up in the list. So, an example finished line would look like this: [lua]list.Set( "NPCWeapons", "weapon_ak47", "AK-47" )[/lua] Save newweapons.lua and restart GMod. Any lines you added formatted like above will show up in the list. Keep in mind that not all NPCs will be able to use SWEPs, trying to force one to use a SWEP might result in a barrage of errors. Do this at your own risk.
Thanks alot
hey man, can you explain this to someone who is a complete idiot.....or at least new to all this.[QUOTE=smallfry;15923146]You can manually do this with npc_create_equipment weapon_classname, but that's tedious. Here's how you can add SWEPs to the NPC spawn menu. Make a new file in lua/autorun. Name it anything, like newweapons.lua. Open it with notepad, and paste as many instances of this line as you want: [lua]list.Set( "NPCWeapons", "weapon_classname", "DisplayName" )[/lua] You can find the classname of a SWEP by looking in the console after you give it to yourself from the menu. It should say something like: [code]Giving your name a weapon_classname[/code] In garry's CSS SWEPs, the classnames are formatted like weapon_m4, weapon_ak47, weapon_glock, etc. The third parameter, "DisplayName", should be the name that shows up in the list. So, an example finished line would look like this: [lua]list.Set( "NPCWeapons", "weapon_ak47", "AK-47" )[/lua] Save newweapons.lua and restart GMod. Any lines you added formatted like above will show up in the list. Keep in mind that not all NPCs will be able to use SWEPs, trying to force one to use a SWEP might result in a barrage of errors. Do this at your own risk.[/QUOTE]
Sorry, you need to Log In to post a reply to this thread.