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.