{{htmlmetatags>metatag-keywords=(pac3,wiki,gmod,mdl,tutorial,guide,help,files,zip) metatag-description=(A tutorial on how to use zipped MDL files in PAC.) metatag-og:title=(Using MDL files in PAC.) metatag-og:description=(A tutorial on how to use zipped MDL files in PAC.) }} {{tag>tutorial model}} ====== Using MDL files in PAC ====== ===== Introduction ===== The [[:part:model]] part in PAC lets you load any Source models or models you made yourself using a **ZIP** archive. The models need to be valid **MDL** files. That includes playermodels, NPCs, ragdolls, props etc. ===== Getting models ===== To get models from Garry's Mod, other Source games or workshop addons follow [[tutorial:extracting-files|]]. If you would like to know how to create these models look for a Garry's Mod Playermodel Tutorial. For a very basic guide about compiling models into MDL format see [[tutorial:simple_mdl]]. ===== Preparing files ===== Every model is made out of multiple files and all of them are required for the model to work. Materials can be added as well but are not required, you can add them later in the PAC editor. In many cases you can simply use the **model** and **material** folders, but often you'll have to manually select the needed files. {{:tutorial:mdl:mdl_example.png?direct}} ==== Required Files (Model) ==== The main **.MDL** file as well as all the additional data files such as **.VTX**, **.VVD**, **.PHY**. Some models might not include **.PHY** files or have only one **.VTX** file, that is fine. The additional files are always named the same as the main file (e.g. alyx.mdl, alyx.vvd, etc) and can be found in the same location. You should only include one **.MDL** file in the **ZIP** with the exception of [[#external animations]]. ==== Optional Files (Materials) ==== For the materials to work both **.VMT** and **.VTF** files are needed. If you aren't sure which materials are used by the model see [[tutorial:finding_material_names]] Each **.VMT** (material) is made out of multiple **.VTF** (textures) files, and all of them need to be present. **.VTF** files usually have names similar to the **.VMT** but this is not a rule. If you don't know which **.VTFs** and needed open the **.VMT** (it's just a text file) and look at the file paths. {{fa>fas fa-exclamation-triangle?color=#de3333&fw&lg}} Do NOT include any files or folder other than the ones specified above. ===== Creating .ZIP archives ===== In order to use your files in PAC you need to add them into an **uncompressed .ZIP** archive. This can be done with either **[[https://www.7-zip.org/|7-Zip]]** //(Recommended)// or **[[https://www.rarlab.com/download.htm|WinRar]]**, both methods are pretty much the same so pick the one you want. ==== Using 7-Zip ==== * Select the files you want to use (usually **models** and **materials** folders) * Right click on them and go to 7-Zip > Add to archive * Set the archive format to zip * Set the compression level to Store * Click OK ---- Click to show image. {{ tutorial:mdl:7zip_archive.png }} ==== Using WinRar ==== * Select the files you want to use (usually **models** and **materials** folders) * Right click on them and select Add to archive * Set the archive format to zip * Set the compression level to Store * Click OK ---- Click to show image. {{ tutorial:mdl:winrar_archive.png }} Once the archive is created, do NOT add any more files to it. If you forgot to include something, make a new archive. ===== Using .ZIP files in PAC ===== Now you can finally use your model in PAC. - Upload your **.ZIP** archive -> [[:tutorial:hosting]] - Add the [[:part:model]]((If your model is a playermodel you can use the [[:part:entity]] part as well.)) part to your outfit - Paste the link to your **ZIP** into the [[:part:model#model]] field ===== Example outfits ===== A few example links that you can try in PAC. ==== Entity ==== - **Playermodel** \\ --- Outfit: {{ :tutorial:mdl:animegirl.txt }} --- Archive: {{ :tutorial:mdl:animegirl.zip }} - **Non-human playermodel** \\ --- Outfit: {{ :tutorial:mdl:pony.txt }} --- Archive: {{ :tutorial:mdl:pony.zip }} ==== Model ==== - **Simple prop** \\ --- Outfit: {{ :tutorial:mdl:gift.txt }} --- Archive: {{ :tutorial:mdl:gift.zip }} ===== Additional Information ===== ==== Addons with multiple models ==== For addons that include multiple models or multiple versions of the same model you usually want to pick the one with a base name such as ''model.mdl'' or the one marked as a playermodel (''model_p.mdl''). ---- Do **NOT** use (unless you know that this is what you want): * models marked as ''_npc'', ''_f'', ''_e'' these are usually NPC models * models from the ''c_arms'' folder ---- Since you won't be able to just include all the materials you'll need to find out which materials and textures are used by the model. -> [[tutorial:finding_material_names]] ==== External Animations ==== It is possible to use models that require external animations from a separate **.MDL** model. There are two types of these: == .MDL + .ANI == These should work without any problems, simply include them in your **.ZIP** archive. == .MDL only == Some models only use **.MDL** files for animations, that might cause PAC to select the animation file as the main model file while ignoring the model files (meaning your model will be invisible). You can work around that by including a dummy **.ANI** file in your **.ZIP** archive. Download {{:tutorial:mdl:anim.ani|this file}}((Right Click -> Save Link As...)), give it the same name as the animation **.MDL** and include it in your archive. ==== Folder structure ==== Doesn't seem to matter at all, you can just throw all the files into a single folder. ===== Common errors ===== {{fa>info?color=#3bb0ff&fw&lg}} Check your console (~ key) for errors, then look for a solution below. ==== Model gets stuck on ''downloading...'' or model doesn't show up and no errors pop up. ==== Make sure you're using the [[:part:model]] part and not the **Legacy** > {{icon:bug.png?nolink}} :model: **Model**. ==== Failed to mount GMA mdl ==== Doesn't mean anything specific. It's pretty much just an information that something went wrong. Please open your console and look for other errors. ==== Not loading addon - File not on whitelist ==== PAC only accepts model files (**MDL**, **VTX**, **VVD**, **PHY**), material files (**VMT**, **VTF**) and animation files (**ANI**). If you include ANY OTHER file in your **ZIP** it won't load. ==== File X is compressed! (use compression method 0 / store, or maybe you drag dropped files into the archive) ==== Pretty much what the error says, you most likely set the wrong compression level, also do not drag and drop additional files into the archive once it is created. If you need to add something create it again. -> [[#creating-zip-archives|Creating .ZIP archives]]. ==== bad zip signature (file is not a zip?) ==== Could happen for multiple reasons: * The file link no longer works * The file link is not a direct link * The file is actually not a zip -> [[#creating-zip-archives|Creating .ZIP archives]] * You are out of disc space -> Delete all the games that you're not playing anyway. ==== [PAC3] invalid url / HTTP Request Failed / unsuccessful ==== --- Update: They should work fine in recent PAC versions. **Case 1)** Links with numbers in domain names do not work. For example pac3.pot.ato/example.zip is not going to work. **Case 2)** Links to files that have numbers in their names do not work. For example pac.links/example0.zip is not going to work. ==== [PAC3] lua/pac3/core/shared/util.lua:476: attempt to perform arithmetic on local 'activity_name_offset' (a nil value) ==== Your model seems to be corrupted, if it was extracted from an add-on try [[tutorial:extracting-files|Extracting]] again. ==== [ERROR] addons/pac3/lua/pac3/core/shared/util.lua:563: attempt to compare number with nil ==== Your model seems to be corrupted, if it was extracted from an add-on try [[tutorial:extracting-files|Extracting]] again. ==== [pac3] addons/pac3/lua/pac3/libraries/string_stream.lua:356: attempt to perform arithmetic on local 'd' (a nil value) ==== Your model seems to be corrupted, if it was extracted from an add-on try [[tutorial:extracting-files|Extracting]] again. ==== Entity2 appears as an error despite using a working ZIP ==== BUG? It seems that if you load a model that doesn't work, PAC will reject all other models as well? Try clearing your GarrysMod\garrysmod\data\pac3_cache folder and try again. ==== Other players see missing textures on my model but it works fine for me ==== The model actually has missing textures but you are subscribed to the workshop addon that has them, or have the files somewhere in your GMOD folder, which causes PAC to load the local version for you. If you want to know what other players see, unsubscribe from the addon (the one that has your model). You can then follow [[#missing textures]] to fix the actual problem. ==== Missing textures ==== **Case 1)** You probably missed some of the materials/textures. Check the materials again and make sure that you included all required **.VMT** / **.VTF** files in your **ZIP**. Check the console for errors such as [PAC3] .zip the model wants to find X.vmt but it was not found in the zip archive. ---- **Case 2)** Sometimes materials on models that have multiple material paths don't load properly. --- Update: They should work fine in recent PAC versions. Possible fix: - Decompile the model - Edit the .**QC** file with a text editor - Remove all but one **$cdmaterials** line, it doesn't matter which one is left. - Compile the model ---- **Case 3)** .VMT files that have unquoted texture paths do not load properly. For example $basetexture pac/test is not going to work, you need to change it to $basetexture "pac/test". ==== Could not find .mdl or dx90.vtx in archive. ==== **Case 1)** You forgot to include these files. **Case 2)** You included way too many files in your **ZIP**, most likely materials. If you are trying to use a single model from a multi-model pack, [[tutorial:finding_material_names|check the materials list]] and make sure you are only using the required ones. ---- If you're having any problems feel free to ask in the **#help** channel of the {{icon:discord.png?nolink}} Official PAC Discord \\ Tutorial partially stolen from Techbot. 8-)