Gmod13: Why your shit broke, and how to fix it.

A few things you need to know:

  • There is no more toybox, instead we now have the steam workshop. If you want to download ALL of the toybox content, go here
  • Legacy addons need their info.txt renamed to addon.txt otherwise they will NOT be detected and mounted by gmod.

Why your shit broke:
Garry replaced and refactored a lot of shit during the beta. This includes replacing functions, getting rid of some, and renaming others, meaning, that unless you were REALLY lucky,
almost all of your addons will break. But trust us, this is FOR THE BETTER! These kinds of changes make gmod quite a bit more efficient, stable, and easier to code for!

How to Fix it:
Firstly, if the addon you are using is popular/well maintained (i.e. wiremod) chances are the author already updated it to gmod13, so all you have to do is
A) wait for an update from them and re-download or
B) wait for it to be put on the steam workshop and get it from there.

If however, you are either less patient or your addon is no longer maintained, 95% of errors are easy find/replace fixes. Here is what you do:

1) When in game, you will get an error from your addon (note: these no longer print on your screen instead they go directly to the console) and it will look something like this:



[ERROR] gamemodes/terrortown/gamemode/weaponry.lua:158: attempt to call method 'IsSpec' (a nil value)
  1. Call - gamemodes/terrortown/gamemode/weaponry.lua:158
   2. unknown - gamemodes/base/gamemode/player.lua:248


Obviously yours won’t look exactly like this, but the general information would be the same.

Here’s how the errors break down:
The first line tells you it’s an error, and then prints the file and the line in the file where the error happened.
That information is then followed by a description of the error. Most of the time, your errors will be “attempt to call method ‘SOME_NAME_HERE’ (a nil value)”
meaning that gmod couldn’t find the exact function name.
The numbered lines are called a “stack trace”. You probably won’t need to worry about them, unless the file the first line talks about doesn’t exist (aka it’s garrys file)
then you need to go to the files shown on the “stack trace” to figure out what’s wrong.

2) Once you have found the place where the error is happening and the thing that gmod can’t find, go here
This is a complete change list of what was done in the beta. At this point, all you have to do is use ctrl+f
to find the thing gmod tells you it couldn’t in this file. Let me give an example:



    Say that gmod told me it couldn't find "ValidEntity", so I would search the document for it and get the following line:

    "Removed ValidEntity( ent ) (replace with IsValid( ent ))"

    So the thing I want to copy now is "IsValid"
    

3) Finally, now that you have the new name for the function (or whatever) go back to your file and user ctlr+h to replace all copies of the bad code with the new one you found in the document.



So I would replace all occurances of "ValidEntity" with "IsValid"


TL;DR

  1. Figure out what fucked up.
  2. Go here to figure out what to replace it with.
  3. Replace all occurrences of bad code with the new stuff fromt the above link.

Please note: The above guide is EXTREMELY BASIC, but it should help you fix 95% of problems that arise. HOWEVER, there are issues that are a tad more complex and will need more than basic knowledge of lua, such as the arguments for functions changing. If you find yourself in a situation like that (AFTER using this guide!) feel free to post to the “What do you need help with” thread, and we will try to help you out.

If you guys find a mistake, let me know and I’ll fix it.

Does this mean anyone with at least some knowledge of LUA can fix an addon for Gmod 13 that’s no longer being supported by the devs?

If so, that’s really useful for me!

Henrys animation tool needs fixing.
If it dies ,my interest in gmod dies with it sadly.

luckily enough Gmod isn’t based around just you.

Meanie

Hey one agree! My hope just excelated 200%!
Find it funny that 2 people disagree that garrys mod is not based around me :v:
That must mean that garrys mod was actualy made for me. Only me.
That must mean that if HAT isnt fixed soon ,the world will implode.

Yes, depending on the size and complexity of the addon/script. The majority of changes in GMOD13 are fixed by find + edit.

I want to get WM:RTS working, but as far as I can tell it’s in addon format. Seeing as the only addons I have now are .gma files, I can’t figure out the new addon format.

Exactly the same as the old one. just rename info.txt to addon.txt

you’ll have to update the networking to the net lib

ents.Create() doesn’t seem to work properly anymore


    if SERVER then
       local ent = ents.Create( "sent_blasterbolt" )
    else
        local ent = ents.CreateClientProp( "sent_blasterbolt" )
    end
    if SERVER then
        ent:SetPos(self.Owner:GetShootPos() +  aim * 24 + side * 8 + up * -15)
       ent:SetOwner( self.Owner )
       ent:SetAngles(self.Owner:EyeAngles())
       ent.RocketOwner = self.Owner
       ent:Spawn()


99% sure ent will only exist inside that if statement

[editline]25th October 2012[/editline]

since it’s defined as a local inside of it

if CLIENT then
ents.Create = ents.CreateClientProp
end

Fuck you garry

Is it me or can anyone else access the guide to figure out how to fix anything.

Noticed this as well, looks like the main changelist for GMOD13 was removed and replaced with this

If your talking about the “Why your scripts are now broken” doc then that’s still here

EDIT:

A backup of the changelist can be found here, I would keep a copy locally just in case.

Thanks for restoring that stuff, today I start on trying to get WM operational again.

Not my pastebin, found it in the gmod discussion section which was lucky.
Also found the changelist on the wiki under the “Porting from GMod 12” section which can be found here
Should have checked the wiki first but I’m on my 10th cup of coffee so I’m missing a few things as the caffeine does more harm then good.

Next error I’m getting:


[ERROR] ...warmelons/lua/weapons/gmod_tool/stools/lap_cappoints.lua:23: bad argument #1 to 'SetAngles' (Angle expected, got userdata)
  1. SetAngles - [C]:-1
   2. LeftClick - ...warmelons/lua/weapons/gmod_tool/stools/lap_cappoints.lua:23
    3. unknown - gamemodes/sandbox/entities/weapons/gmod_tool/shared.lua:240

Line Was:


	melon:SetAngle(trace.HitNormal);

Line Is Now:


	melon:SetAngles(trace.HitNormal);

What am I doing wrong here? The guide pretty much just said to add an s to Angle.

Line looks the same to me (Unless you copy+pase the same line twice)

I’m also having this problem though and I’m not having much luck with it.

Meant to just add the S, to Angle, it’s actually set that way in the file, corrected post above.

That [C]:-1 portion is confusing me, not sure what’s meant by it saying it got user data and not an angle.