Hi! Sorry for posting it here and looking like I completely ignored Garry's locked and pinned post. But I couldn't find the modding help anywhere in the forum. If it is there then could this thread be moved. Thanks!
Hi. I need help on some Lua functions that were changed in the GMOD 13 update. I'm looking specifically to convert some of my favorite SWEPs that unfortunately weren't converted to GMOD 13.
[CODE][ERROR] addons/toybox sweps/lua/weapons/weapon_can/shared.lua:672: bad argument #1 to 'AddAngleVelocity' (Vector expected, got userdata)
1. AddAngleVelocity - [C]:-1
2. ThrowCan - addons/toybox sweps/lua/weapons/weapon_can/shared.lua:672
3. HandleCustomAnimationEvent - addons/toybox sweps/lua/weapons/weapon_can/shared.lua:721
4. SSAnimThink - addons/toybox sweps/lua/weapons/weapon_can/shared.lua:806
5. unknown - addons/toybox sweps/lua/weapons/weapon_can/shared.lua:766[/CODE]
[CODE]
[ERROR] addons/toybox sweps/lua/weapons/weapon_anoth_laser/shared.lua:1074: bad argument #2 to 'CreateFont' (table expected, got number)
1. CreateFont - [C]:-1
2. unknown - addons/toybox sweps/lua/weapons/weapon_anoth_laser/shared.lua:1074[/CODE]
[CODE][ERROR] addons/toybox sweps/lua/weapons/weapon_eats/shared.lua:42: bad argument #2 to 'Exists' (string expected, got boolean)
1. Exists - [C]:-1
2. unknown - addons/toybox sweps/lua/weapons/weapon_eats/shared.lua:42[/CODE]
[CODE][ERROR] addons/toybox sweps/lua/weapons/weapon_sauger/shared.lua:410: attempt to call global 'GetWorldEntity' (a nil value)
1. unknown - addons/toybox sweps/lua/weapons/weapon_sauger/shared.lua:410[/CODE]
[CODE][ERROR] addons/toybox sweps/lua/weapons/weapon_real_ar-15/shared.lua:91: bad argument #1 to 'SetFOV' (number expected, got nil)
1. SetFOV - [C]:-1
2. unknown - addons/toybox sweps/lua/weapons/weapon_real_ar-15/shared.lua:91
3. SelectWeapon - [C]:-1
4. unknown - gamemodes/sandbox/gamemode/commands.lua:701
5. unknown - lua/includes/modules/concommand.lua:69
[ERROR] addons/toybox sweps/lua/weapons/weapon_real_ar-15/shared.lua:118: bad argument #1 to 'DefaultReload' (number expected, got no value)
1. DefaultReload - [C]:-1
2. unknown - addons/toybox sweps/lua/weapons/weapon_real_ar-15/shared.lua:118[/CODE]
[B](The AR-15 actually works it's just this error when reloading and scoping)[/B]
[CODE][ERROR] addons/toybox sweps/lua/weapons/weapon_fun_laser/shared.lua:320: attempt to call global 'WorldSound' (a nil value)
1. unknown - addons/toybox sweps/lua/weapons/weapon_fun_laser/shared.lua:320[/CODE]
[CODE][ERROR] addons/toybox sweps/lua/weapons/weapon_kantan/shared.lua:187: attempt to index local 'self' (a nil value)
1. unknown - addons/toybox sweps/lua/weapons/weapon_kantan/shared.lua:187
Timer Failed! [Simple][@addons/toybox sweps/lua/weapons/weapon_kantan/shared.lua (line 181)]
[ERROR] addons/toybox sweps/lua/weapons/weapon_kantan/shared.lua:229: attempt to index local 'self' (a nil value)
1. unknown - addons/toybox sweps/lua/weapons/weapon_kantan/shared.lua:229
Timer Failed! [Simple][@addons/toybox sweps/lua/weapons/weapon_kantan/shared.lua (line 173)][/CODE]
[CODE][ERROR] addons/toybox sweps/lua/weapons/weapon_ran_npc/shared.lua:533: attempt to index field 'TNpc' (a nil value)
1. MenuRebuildNpcList - addons/toybox sweps/lua/weapons/weapon_ran_npc/shared.lua:533
2. MenuOpen - addons/toybox sweps/lua/weapons/weapon_ran_npc/shared.lua:577
3. Function - addons/toybox sweps/lua/weapons/weapon_ran_npc/shared.lua:570
4. unknown - lua/includes/modules/usermessage.lua:87[/CODE]
[CODE][ERROR] addons/toybox sweps/lua/weapons/weapon_super_g/shared.lua:356: bad argument #1 to 'GetDTBool' (number expected, got string)
1. GetDTBool - [C]:-1
2. Function - addons/toybox sweps/lua/weapons/weapon_super_g/shared.lua:356
3. unknown - lua/includes/modules/usermessage.lua:87
[ERROR] addons/toybox sweps/lua/weapons/weapon_super_g/shared.lua:578: bad argument #2 to 'ChangePitch' (number expected, got no value)
1. ChangePitch - [C]:-1
2. unknown - addons/toybox sweps/lua/weapons/weapon_super_g/shared.lua:578[/CODE]
I'm sorry for posting a lot of lua errors but It's gmod 12, what more could you expect ? XD
Here's a thread that has resources of what changed from GMod 12 to 13: [url]http://facepunch.com/showthread.php?t=1337945[/url]
Thank you for the reply. I have already seen those pages and they didn't help much with the SWEPs I'm converting currently.
Hard to fix these without seeing the actual Lua files, or at least the lines that the errors are on. Can you share the lua files?
[IMG]http://s16.postimg.org/75q5oqh05/Untitled.png[/IMG]
This is the lua for the Can Nade.
[IMG]http://s7.postimg.org/dad16voe3/Untitled.png[/IMG]
Lua for the Laser Gun.
[IMG]http://s22.postimg.org/q68q11k9d/Untitled.png[/IMG]
Lua for Eat SWEP
[IMG]http://s18.postimg.org/wh8bpubrt/Untitled.png[/IMG]
Lua for Scav JR
More screenshots will be up soon. When I can find the toybox files buried under gigabytes of gmod addons...
1.
[code]can:GetPhysicsObject():AddAngleVelocity( 600, math.random(-1200,1200), 0 )[/code]
2. I can't see the whole line, but you need to convert it to the [URL="http://wiki.garrysmod.com/page/surface/CreateFont"]new format for fonts[/URL].
3.
[code]local hasTF2 = file.Exists("sound/vo/SandwichEat09.wav", "GAME")[/code]
You can also find if the client has TF2 by using IsMounted, although, it seems file.Exists is better in the context that it's used in.
4. What is GetWorldEntity() defined as?
Thank you very much!
[IMG]http://s28.postimg.org/obvcu9vx9/Untitled.png[/IMG]
Updated screenshot of the Laser Gun
When you say defined as... Do you mean to say what it's supposed to do?
It's supposed to make objects disappear with right click (as in sucking them in) and shooting them out with left click.
[IMG]http://s1.postimg.org/ts50kfyxb/Untitled.png[/IMG]
Screenshot showing both errors on the AR-15
[IMG]http://s12.postimg.org/ahqfgbby5/Untitled.png[/IMG]
Screenshot on the Shock Rifle
[IMG]http://s27.postimg.org/oo0p6j3g3/Untitled.png[/IMG]
Screenshot on Katana
[IMG]http://s29.postimg.org/5y7xrevgn/Untitled.png[/IMG]
Screenshot on NPC gun.
[IMG]http://s3.postimg.org/u5am2titf/Untitled.png[/IMG]
Screenshot on Punt Cannon
The first error on the AR-15, I'm not exactly sure what's wrong, I think it requires the FOV as a number rather than self.Fov
The second error on the AR-15
[URL]http://gmodwiki.net/Lua/Classes/Weapon/DefaultReload[/URL]
It requires an ID inside the brackets.
For the shock rifle, WorldSound doesn't exist. Try
[code]
sound.Play( "ut2k4/shockrifle/explosion.wav", self:GetPos() )
[/code]
Try changing both lines on the Katana to
[code]
self:GetEyeTrace()
[/code]
if that doesn't work, do
[code]
LocalPlayer():GetEyeTrace()
[/code]
As for the two last ones, I'm not sure on the NPC gun, and where is the error exactly on the last one?
The npc gun error is the TNPC
Punt cannon has two errors
GetDTBool
and
ChangePitch
You could try changing Tnpc to NPC but I'm not sure if that will fix it.
On the punt cannon:
Change "ent" to Entity so it's Entity:GetDTBool
On the change pitch, change it to
[code]
if SERVER then self.ChargeSound:ChangePitch(100+self.dt.Charge/1.7, 0);end
[/code]
On the katana fix. Both of them seemingly fix the error (according to the console) but the effect is still there, both attacks don't harm anything.
The can nade still bugs out when you throw it. And the secondary function (to drink it and gain health) doesn't display an error but it just does not work.
Also the model of the can nade doesn't appear.
I could link the files so you can try it for yourself?
Sorry, you need to Log In to post a reply to this thread.