Project Zomboid

Project Zomboid

Improvised Silencers by Maxwell218
Quick & Dirty DIY Patching (for other weapon mods)
Disclaimer: the code for the silencers *looks* friendly enough to play nice with things but I guarantee compatibility as much as the author of this mod does. Which is to say...not at all.



A quick glance at the code on the B41 side of things (not that this mod appears to have a B42 setup currently) reveals two (three, if we count the black list file) files you'll need. Using the VFE Compatibility submod path as an example, structure is identical for the base version.

Steam\SteamApps\workshop\content\108600\2799742455\mods\VFE Compatibility\media\lua\shared\ISIL_ModelTable.lua

Steam\SteamApps\workshop\content\108600\2799742455\mods\VFE Compatibility\media\lua\client\ISIL_ModelTweaker.lua

The first one is the one that you want in order to allow the silencers to be attached to weapons. The second is the fun part where you edit the offsets in very minute increments so you don't have them floating in funny spots. For the extremely (IT) illiterate, a quick and dirty patching method would be to open up the ISIL_ModelTable.lua with Notepad++.

Our dirty example will use Totally's Historic Weapons' Makarov. First, we need to locate the Makarov's item name...



Steam\SteamApps\workshop\content\108600\2897536185\mods\Totally's Historical Firearms Pack\Media\scripts\TIHFP-Firearm.txt



...which is conveniently simply 'Makarov'.



item Makarov



This is relevant because the M9 from the base game for example is simply 'item Pistol'. Some mod authors may have uh, interesting ideas about internal item names such as VFE which has bayonet attachments on SKS and are technically their own distinct item. Anyway. Now we just need to open the ISIL_ModelTable.lua. Using the VFE patch file as an example, that file ends at...



["Base.CampCarbine"]=1,
}



So all we do is just go...



["Base.CampCarbine"]=1,
["Base.Makarov"]=0,
}



...and we can now add the full range of pistol compatible silencers to the Makarov. If it's not bleedingly obvious, we're just appending Base. to an item name. The change in numbers is explained right up the very top of the file:

-- 0 pistol silencer, 1 shotgun silencer, 2 rifle silencer
-- If the weapon isn't in this table and has no blacklist, then it won't give the attach prompt

...so just edit per common sense (or just change everything to 0 and start fitting water bottle silencers on shotguns or something). Now the catch is, all of this is going to look hilarious like some sort of poorly made game from 1993 that failed it's QA. You'll get a silencer floating in the middle of the air and totally not attached to the barrel. That's what ISIL_ModelTweaker.lua is for. That should be just as straightforward to read - basically just copy an existing entry then start tweaking the three numbers after 'offset' and before 'rotate'. Have uh...fun with that?

To recap;

1) Find the modded item name (mod structures vary but you'll probably want to check for a media folder and work from there)
2) Open ISIL_ModelTable.lua
3) Add item in while appending Base. to it. (If using Notepad++, go to the end of the CampCarbine line after the comma and just ctrl+D a few times then double click the copied CampCarbine parts and paste the new modded item, such as the Marakov)
4) If you have time to waste and want sexy looking weapons in addition to practicality, open ISIL_ModelTweaker.lua and edit that one accordingly...
4a) I suppose a heavy handed approach would be to simply cut out the model related parts to turn the silencers invisible or scale them to be incomprehensibly small. Scaling is located at Media\scripts\ISIL_Models.txt. Just slap a couple of 0's into the scale =0.01 lines.
Last edited by Rin.Hawkwing; Jul 27 @ 12:43pm