Insurgency

Insurgency

Not enough ratings
Add--not replace--workshop weapons to your server
By James
Add--not replace--workshop weapons on your Insurgency server.
   
Award
Favorite
Favorited
Unfavorite
Intro
I've never wrote a guide before, but after spending a lot of time figuring this out, I thought others might find it useful.

Googling this topic involves decompiling .mdl files with the Crowbar app (which alters delta animations like aiming down sights) and using 3D modeling applications to fix it. I tried that and it wasn't a feasible approach if you're thinking of adding more than 1 weapon. Thanks to Delta Mike at insgamer.com for telling me that I don't have to decompile .mdl files to change the filename inside the .qc file, and instead use a hex editor.

Note: Packaging a .vpk that holds ~3 weapons reaches the .vpk size limit. You'll need to learn to compress certain files (I believe the ones in the materials folder) if you want to add more weapons/items at a reasonable file size.

Update on hex editing/skinning (2019-04-15): I haven't personally used or verified the usefulness of this tool, but was recommened by a user following this guide. "(Steam user Leakbang) found this program called Skin Editor that will let you add, edit, or delete skins on a .mdl file. This is very useful cause it removes the headache of using a hexeditor. You can also modify various properties of the .mdl file such as the mass, surface property, and etc."
Getting started
Useful Locations
SteamLibrary\steamapps\workshop\content\222880
SteamLibrary\steamapps\common\insurgency2\insurgency
SteamLibrary\steamapps\common\insurgency2\insurgency\custom
SteamLibrary\steamapps\common\insurgency2\insurgency\custom\workshop
SteamLibrary\steamapps\common\insurgency2\insurgency\scripts\theaters

Need
  • GCFScape
  • XVI32 hex editor
  • Knowledge of how to use theater files
  • Text editor
  • tutorial_theater.theater (it's messy since I tried to delete a bunch of irrelevant sections from my original file)
https://github.com/heyjames/insurgency-dedicated-server/blob/master/tutorial_theater.theater

Get GCFScape and create a shortcut on the desktop
Locate vpk.exe (SteamLibrary\steamapps\common\insurgency2\bin\) and create a shortcut on the desktop

I'll be using MrBrightside and Tigg's SA80 - L85A2 as an example. https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=717059270

Subscribe to it. Workshop subscriptions will download to either
SteamLibrary\steamapps\workshop\content\222880
SteamLibrary\steamapps\common\insurgency2\insurgency\custom\workshop

The "222880" folder may be different for you. It'll contain folders with workshop IDs as their name. Sort by descending Date modified and "717059270" should appear. Open it and "brightside_l85a2.vpk" should be there.
Prepare the extracted vpk
Drag or open from GCFScape and you'll see a folder structure containing "root", "materials", and "models". Extract "root" somewhere of your choice. You can delete the "sound" folder and "gameinfo.txt". If you use GCFScape to look at several .vpk files in (SteamLibrary\steamapps\common\insurgency2\insurgency) like "insurgency_materials_dir.vpk", "insurgency_misc_dir.vpk", "insurgency_models_dir.vpk", etc, it contains the same tree, which houses the files needed for the original Insurgency weapons, items, etc.

Since the L85A2 replaces the M4A1, we want to create some text in certain places outside of the files contained in "brightside_l85a2.vpk" so the game can recognize a new entry, and then change some text inside "brightside_l85a2.vpk" so the new entry has a new weapon with animations to point to it.

We have to add a missing .vmt file first. Open a text editor and put this in there:

"UnlitGeneric"
{
"$translucent" 1
"$basetexture" "vgui/inventory/weapon_l85a"
"$vertexcolor" 1
"$vertexalpha" 1
"$no_fullbright" 1
"$ignorez" 1
}

The "2" in "l85a2" is deliberately left out to keep the number of characters consistent. It doesn't need to be but I don't know of the way to do it. I tried it once and my final .vpk package didn't work. I've seen it be done before, though. Anyways, make the file name "weapon_l85a.vmt" and place it in "root\materials\vgui\inventory", which is inside the root folder that was extracted from the .vpk file you downloaded from the workshop. Within the same directory, rename "weapon_m4a1.vtf" to "weapon_l85a.vtf". This folder is responsible for the image that appears when you open your loadout screen. Most .vpk weapon files from the workshop will include the .vtf but probably not the .vmt file in which you use a simple text editor and copy-paste the above while remembering to change the weapon_**** to the appropriate weapon name.
Hex editing
Download a hex editor. I'll be using XVI32. Go to "root\models\weapons" and open "v_m4a1.mdl" with the hex editor. On the right side, you want to look for (typically 2 search results CTRL+F) "v_m4a1.mdl" and change it to "v_l85a.mdl". Make sure you're not inserting, but rather overwriting, which is why I keep the number of characters the same as the author's replacing weapon. You can see which method you're on at the bottom of the window. Just press the insert key on your keyboard to swap to insert or overwrite. I've tried overwriting "m4a1" and then inserting more characters, but it didn't work for me. I know others have had success with inserts, though, perhaps with another application or method. Save it and exit the application. Now rename

v_m4a1.vvd
v_m4a1.mdl
v_m4a1.dx90.vtx

to

v_l85a.vvd
v_l85a.mdl
v_l85a.dx90.vtx

Then do the same for the 4 "w_m4a1.___" files include the hex editor search. Then go into the "root\models\weapons\upgrades" folder and do the same for all files except for w_flipup3.___, and a_standard3,4,5,6.___.
"m4a1" changes to "l85a"
"m4" changes to "l8"
"m203" changes to "ag36" (Heckler & Koch AG36 40mm grenade launcher).

"root\materials" and "root\models" are now done.
Add new weapon name and description to display in loadout screen
Create a folder in the root folder called "resource". We want to grab an existing file used to list all sorts of items from the loadout screen. Open "SteamLibrary\steamapps\common\insurgency2\insurgency\insurgency_misc_dir.vpk" with GCFScape and expand "resource" to locate "insurgency_english.txt". Extract that into the "resource" folder you created.

Open the "insurgency_english.txt". I don't think it matters where you put text for the L85A2, but I'd scroll to an appropriate location like line 440 (line # may change as Insurgency is updated. Place near other weapons like "weapon_gurkha") and add alongside the other weapons:

"weapon_l85a" "L85A2"
"weapon_l85a_desc" "Mod by MrBrightSide and Tiggs with awesome animations"

This will be what you see in the loadout screen when you mouse over the weapon, complete with description.

This "insurgency_english.txt" file is normally loaded by the game in the insurgency_misc_dir.vpk, but your copy will be placed in your "root" folder and will have the one with the L85A2 name and description, so it'll take this custom one instead. The final part has to make sure the theater file that normally loads actually loads your custom theather file which contains the L85A2 weapon properties, attachments, etc.
Add weapon properties in theater file
Open "SteamLibrary\steamapps\common\insurgency2\insurgency\insurgency_misc_dir.vpk" in GCFScape and extract root\scripts\theaters\default_weapon.theater. We'll be using "weapon_m4a1" as a template for the L85A2's properties. I created a theater file and copy and pasted that into mine. I'm going to change a few lines in the "viewmodel_attachments" section and some right above that. I also changed some numbers in the "fov" section. See my included theater file.

Notice the "resource/insurgency_english_j.txt" in the beginning of my theater file. It recognizes the weapon name and description for the L85A2. A lot of the necessary parts are copy and pasted from the theater files inside "SteamLibrary\steamapps\common\insurgency2\insurgency\insurgency_misc_dir.vpk" and inserting "weapon_l85a".

Navigate to the directory above "root", and drag and drop the "root" folder into the vpk.exe shortcut that you created in the beginning of this tutorial. This will create a "root.vpk" in the same directory. Rename if you want, but move it to "SteamLibrary\steamapps\common\insurgency2\insurgency\custom". Your game will automatically read the "root.vpk" when the game launches. Launch Insurgency and open console with the tilde key. Type this without quotations "mp_theater_override tutorial_theater; map ministry_coop". This will select the theater file I included from "SteamLibrary\steamapps\common\insurgency2\insurgency\scripts\theaters" so make sure you put it in that directory. Then it will load a small--and quick loading--map. Once the map has loaded, you can make changes in the theater file like changing the fire rate number in "weapon_l85a" and immediately switch back to Insurgency, open console, press the up arrow and "mp_theater_override tutorial_theater; map ministry_coop" will auto appear and press enter. Making certain deletions may cause the game to stop upon saving the deleted changes. Changing anything within the "root" folder requires that you exit Insurgency, repackage "root" folder with the vpk.exe shortcut, moving it into "SteamLibrary\steamapps\common\insurgency2\insurgency\custom" again, starting Insurgency, and using "mp_theater_override tutorial_theater; map ministry_coop" through console.

Once you're done testing, you want to include your theater file in your packaged .vpk file. Create the folder tree and it should look like this: "root\scripts\theaters\your_theater_file.theater". Note: Capital letters may prevent your theater file from working. Launch game, select workshop, include required image, upload to workshop, copy and paste your workshop item ID into your subscribed_id.txt file on your server. Make sure the workshop item is public, or you won't be able to serve it to users.
Additional fun attachments for your new weapon
You can add "reload_speed" "5", "holster_speed" "5", increase fire rate to "2000" and see what happens for fun. You can also include some of these properties as a separate attachment including extended mags, decreased recoil with custom foregrip. Here's what it'll look like. Also, "upgrade_slot" can beone of these: "Optics", "Ammo", "Magazine", "Barrel", "Stock", "Siderail", "Underbarrel", "Aesthetic", "Misc.". This one in particular was having the weapon point to the .mdl file which points to the materials folder of the black variant, so the Remington ACR would change from tan to black. You can remove the "viewmodel_attachments" and "world_attachments" section if you only want something like reload and holster speed. One issue that happened is the iron sights didn't "fallback" when selecting optics (they didn't disappear). This property works in the large weapon's properties section in the theater file but not here. Let me know if anyone finds a solution to this encounter.

"weapon_racr"
{
"print_name" "#acrb"
"print_desc" "#acrb_desc"
"upgrade_cost" "1"
"upgrade_slot" "aesthetic"
"reload_speed" "5"

"allowed_weapons"
{
"weapon" "weapon_racr"
}

"viewmodel_attachments"
{
"weapon_racr"
{
"model" "models/weapons/v_acrb.mdl"
}
"flipsights"
{
"model" "models/weapons/upgrades/a_standard_racb.mdl"
"fallback_for_slot" "optics"
}
}

"world_attachments"
{
"weapon_racr"
{
"model" "models/weapons/w_acrb.mdl"
}
}

"team_access" "security, insurgent"
}
Common Issues
Weapon name is showing "#weapon_l85a" and "#weapon_l85a_desc" in-game.
  • Make sure "root\resource\insurgency_english.txt" is there with correct folder names and directory structure and includes something like:
"weapon_l85a" "L85A2"
"weapon_l85a_desc" "Description goes here"
  • Make sure your theater file has this:
"core"
{
"precache"
{
"localize" "resource/insurgency_english.txt"
}
}

The picture for the weapon or attachment is purple/pink checker
  • Sometimes the mod supplies the inventory picture in "root\materials\vgui\inventory". You can create your own through GIMP/Photoshop with .vtf plugin, then create the accompanying .vmt file in a text editor and change the one file name inside to match the actual file name.
My weapon is covered in a pink shiny mesh
  • There is something wrong in the "root\materials" folder or the .mdl file in "root\models\weapons" and "root\models\weapons\upgrades" is still pointing to a stock weapon.

  • "root\materials" folder contains a bunch of .vmt files. Make sure each one has the correct path (e.g. the "l85a2" part)
"$basetexture" "models\weapons\l85a2\emag_diff"
"$bumpmap" "models\weapons\l85a2\emag_bump"

Giant blue error or weapon isn't appearing in loadout or first-person view
  • There may be a typo in the "weapon_l85a" properties in the theater file that points to v_l85a.mdl. Make sure this line is correct in the theater file, and the file name is also called v_l85a.mdl, and the 2 locations when opened with the hex editor points to "v_l85a.mdl".
"view_model" "models/weapons/v_l85a.mdl"

Hilariously gigantic foregrip
  • Go to the theater file and set the scale property in the appropriate area under the foregrips. See where I did it in my "tutorial_theater.theater" file.
"weapon_l85a" "0.5"

The sights/scopes are not aligned properly
  • This is a really annoying part since there's like 7 sight attachments to check. On the eotech sight, if it appears too low and there's a black area on the top of the scope, you need to figure out which eotech size is being used in the theater file. Go to the eotech section and see where m4a1--the replacing stock weapon--exists in each category (small, normal, large, extra large) and put in an entry for the l85a2. Notice the "excluded_weapons" in the normal eotech section. It's probably using that as the default and isn't large enough for the L85A2 model, so put a line for the L85A2 there and then again in eotech extra large since M4A1 exists there. Putting it in eotech large also works, and I didn't notice any difference, but I think being consistent with the original stock weapon is wise. Now do this 6 more times for the other sights =).

  • You will encounter more trouble with the 2x aimpoint, 3.4x elcan, po4x, and maybe the 7x (I never went far enough to test the 7x variants). For these, go to the l85a weapon properties in the theater file and edit the "fov" section. I've provided some context into what each of one sort of does in tutorial_theater.theater. There may be a better way to fix this, but I don't know.
Stock foregrip doesn't appear on my weapon even though everything in the theater file looks correct
  • An odd one, but I've encountered 2 times where the order of the section matters. For example, the L85A2 has a special foregrip that you need to get from the workshop that's included in MrBrightSide's collection. In tutorial_theater.theater, you'll see that the "underbarrel_grippod" is located underneath the "underbarrel_foregrip_sec1" section. I had it the other way around before and the foregrip for adding another workshop item that uses a regular foregrip didn't appear until I made "underbarrel_foregrip_sec1" appear first in the theater file. The other time was mk18 not adhering to the weapon cost or weight I added until I moved it higher before others in the theater file.
20 Comments
DieKaiserschlacht 25 Jan, 2023 @ 12:44am 
would this be possible with a character skin instead of a weapon
blxckdreadful 19 Feb, 2022 @ 4:23pm 
Hey, yes mb it was as you said, I made it work just hours after tweaking. Thanks, James!
James  [author] 19 Feb, 2022 @ 12:37pm 
@blxckdreadful I don't think I've ever done it for attachments. I suppose it's a similar process--one that you need to duplicate in the theater file with its unique name, do hex editing, and repack the VPK file.
blxckdreadful 19 Feb, 2022 @ 4:26am 
I know this is pretty old but this is where I learned from, I'm having trouble with making the vgui appear for the custom attachments, since they are named differently. Do you still know how to assign the vgui to the attachment instead of a weapon?
James  [author] 30 Oct, 2020 @ 1:17pm 
@VaweR, I wrote this a long time ago and I acknowledge it's poorly written as I just wanted others to at least know they're in the right general direction. From what I remember after reading this section again, the "Add weapon properties in theater file" section deals with using the default VPK file in the Insurgency directory to get the weapon stats. I think the idea was to look for the m4a1 data and duplicate it, but rename any instance of the m4a1 word to l85a1. That requires extracting the right file with the application, edit it in a text editor, and then repackaging it to become a VPK.
VaweR 30 Oct, 2020 @ 8:12am 
I got lost at "Add weapon properties in theater file". Is there some shorter method?
kikyoulin 16 Jun, 2019 @ 2:23am 
hey bro, thanks for ur reply, I have made it just now. "resource/custom_%language%.txt" and change these files' name.
James  [author] 16 Jun, 2019 @ 12:18am 
@kikyoulin I have no idea
kikyoulin 14 Jun, 2019 @ 12:52am 
hey, friends. Thanks a lot, I have added 98k sniper to my server successfully. However, if I want to support 2 languages, how can I write in "localize" parameter in "precache"? Thanks again.
76561198441531460 16 May, 2019 @ 1:43am 
k