Sunday, October 28, 2012

Gmod 13: how to fix broken model addons

Gmod 13 is no longer in beta. It's slick...has workshop support at the click of a button, and lots of shiny cool stuff. Updates are fun! However...

Of course, EVERYTHING OLD BROKE.

After some research and much stalking on the FP forums(which I will not link due to some of the content of that site being...well, let's just say not so good for most eyes.), I've found a few fixes so far that let one salvage stuff made for 10.

In order to help people not have to do so much digging and questioning, I'm listing the major thing here that let most of my stuff work again.
 
NOTE: This is going to take a bit of work with files on your end. If you are not comfortable with mucking about in files, it's probably best that you stick with what others are converting on the steam workshop and just put up with the fact all your old NPCs, models, and props don't exist.



First rename all the files named "info.txt" into "addon.txt".

Yes, I mean all those files inside the subfolders of the millions of addons you installed like a fool. Yes, this is terribly tedious if you have lots of different models or have sorted them all into physical folders.
 
Truth be told, I cheated after doing about 3 of them.
 
Here's a batch line that will do that file renaming for you. This assumes you are in Windows. I don't own a Mac and don't run Garrys mod in Linux so I can't speak for those other two.

forfiles /S /M info.txt /C "cmd /c rename @file addon.txt"

Copy that line exactly, open a new text file in notepad, paste that line, and save it to your Garrys Mod/Garrys Mod/Addons folder as renaming.bat (you can actually use any name you want but it must end in .bat)
 
Now just run it (MAKE SURE IT'S IN THE addons folder, or you'll process everything on your entire computer instead!), and everything in that directory and subdirectory will be renamed through the wonders of .bat processes. Yay!

So far, everything that is models, ragdolls, or just static props should work fine. If that's all you had to convert or wanted, good for you, you can leave this guide now and enjoy all your old stuff.


Unfortunetly, most of the cool stuff like NPCs, tools, spawners, and such use a scripting language called lua.  If a lua file is nothing but jibberish to you(as in, you can't understand code), then stop here.  Your time is much better off spent playing Gmod and just letting the original designers of the addons update the code and workshop enable the tools for you.  Just accept the fact nothing with lua in it will work in the new Gmod unless someone who knows the scripting updates it, and continue playing with your models and all the new stuff while you wait.

If you are still here, and you are not afraid of editing and potentially rewriting some code, and you really badly need a tool, the best resource I found for what's been changed is this google document here:

https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit

Most of the changes just involve a bit of find and replace of function calls, and possibly a swap of parameters. It's tedious and time consuming work, but not too difficult if you know what you are doing. If you don't, I'd recommend just waiting for the expert lua coders over at facepunch forums to convert stuff and upload it to the workshop for others to use.

I haven't the time to get any farther then this myself, so I'll have to say this is where I stop. As you can see, from here on out it's going to be extremely time consuming, and I think that's best left to the lua authors themselves who know what they are doing. Hats off to them.

6 comments:

  1. Hi I found this very helpful so thank you, but I still have a problem...

    My left 4 dead 1/2 models have missing body parts arms/legs/fingers are just invisible. I've noticed that his is mainly a proximity thing, because if I stand at the other side of the map these parts magically come back.

    Do you know what this could be?

    ReplyDelete
    Replies
    1. I don't have left for dead, but I do know both games are running on a slightly different Half Life 2 Engine then Garry's Mod and Half Life 2. I can't get much further then that since I don't own the games and thus don't have the models in question. Sorry. :(

      My best uneducated guess is that there is something weird going on with a Level of Detail feature, since from your description they show up fine when far away.

      I don't know what one could do about it though. It sounds like something Garry himself would have to add to the engine or fix, unless someone custom "ports" the models, stripping them of whatever LOD feature is causing the problem in the first place. Either solution would be a lot of gritty, tedious work.

      Sorry I couldn't help much. :(

      If you figure out how to get them working though, do post the solution. People who find the comment through searching later would probably appreciate it.

      Delete
  2. What about custom models, IE: the MLP pack or Mass Effect models? What about custom models?

    ReplyDelete
    Replies
    1. Custom models should actually be the same procedure, assuming it went in addons through an addons folder.

      Differences in the engine itself may cause odd conversion errors, but they should at least show up. (For example, not all my models acted the same when I did it, some were about twice as heavy as before, but they at least showed up and spawned in game).

      If for whatever reason the model did not go in addons when you installed it, and instead went straight into the model folder, you'll need to remember exactly what files and file structure(folder structure too for textures of models) they had when you installed the pack. Then you need to convert them into an addon format.

      The easiest way to do it is to copy the structure of an existing addon folder, then copy and edit the addon.txt in the new folder to a different setting. (I'm not sure how Gmod behaves if the addons have the same data, so make sure to at least give it a unique addon name in the new addon folder txt file.) I know it doesn't sound like the easiest way, but it's really the only way I know of without having to request one from the authors of the addon themselves.

      You'll need to make very sure that the paths between files are the same or you will get texture errors. As a matter of fact, some may end up with the "pink environmental map" errors anyway, even when converted correctly. I haven't figured out why yet, but I'm guessing the only real fix is to recompile the models into the new engine or otherwise convince them not to use the environmental mapping.

      Not everything converts smoothly, but this info should at least get you started. Good luck!

      Delete
  3. Replies
    1. If you don't understand the instructions, my best advice to you would be to just use Workshop and let other community members convert stuff, as you probably don't know enough about how models and addons in Gmod work to understand what you'd be doing to the files anyway.

      Delete

Please keep your comments clean and avoid flame wars. Thank you!