Garry's Mod

Garry's Mod

Advanced Particle Controller
A lot of people (including me) are having this error
11/11/2025:
I have to make a separate discussion because a LOT of people in the comments section including me have been getting this error which causes the particles to not display.

[Advanced Particle Controller] lua/entities/particlecontroller_normal.lua:276: bad argument #2 to 'CreateParticleEffect' (number expected, got table)
1. CreateParticleEffect - [C]:-1
2. AttachParticle - lua/entities/particlecontroller_normal.lua:276
3. RemoveParticle - lua/entities/particlecontroller_normal.lua:304
4. unknown - lua/entities/particlecontroller_normal.lua:169 (x1314)

Did GMod released a small update a few days ago? I have a feeling there was.
Last edited by NegativThousandDegrees; Nov 11 @ 1:55am
< >
Showing 1-7 of 7 comments
I apparently checked the GMod news feed from November 6th and it said "BETA RELEASE" on top and not "NEWS".

So it is likely not just an announcement, but also a small hotfix.
Indeed, this broke several addons, including mine, the Team Fortress 2 Bots. Looks like this is a pretty widespread issue.
Originally posted by MrNiceGuy518:
Indeed, this broke several addons, including mine, the Team Fortress 2 Bots. Looks like this is a pretty widespread issue.



I've created a fix for my addon, perhaps the author of this one will see this post and may find this helpful.


The second argument of ENTITY:CreateParticleEffect() must now be a model attachment, and the table that used to define particle control points seems to now be unused.

What I found is that ENTITY:CreateParticleEffect() actually returns an instance of CNewParticleEffect, which has a variety of methods for controlling the particle system, including control point definitions via CNewParticleEffect:AddControlPoint(): https://wiki.facepunch.com/gmod/CNewParticleEffect:AddControlPoint

The indices of the control points are now explicitly specified in the first argument of the aforementioned method, rather than implicitly derived from the indices of the table formerly passed in the second argument of the original function.


Here's an example from some of my tests that may prove useful:

THIS:
local CPoint0 = {
["entity"] = entity1,
["attachtype"] = PATTACH_ABSORIGIN_FOLLOW,
}
local CPoint1 = {
["entity"] = entity2,
["attachtype"] = PATTACH_ABSORIGIN_FOLLOW,
}
entity1:CreateParticleEffect("medicgun_beam_red",{CPoint1,CPoint0})


Must become, THIS:
local pfx = entity1:CreateParticleEffect("medicgun_beam_red",0)
pfx:AddControlPoint(0, entity1,PATTACH_ABSORIGIN_FOLLOW)
pfx:AddControlPoint(1, entity2,PATTACH_ABSORIGIN_FOLLOW)



Hope that helps someone!
same problem
Originally posted by MrNiceGuy518:
Originally posted by MrNiceGuy518:
Indeed, this broke several addons, including mine, the Team Fortress 2 Bots. Looks like this is a pretty widespread issue.



I've created a fix for my addon, perhaps the author of this one will see this post and may find this helpful.


The second argument of ENTITY:CreateParticleEffect() must now be a model attachment, and the table that used to define particle control points seems to now be unused.

What I found is that ENTITY:CreateParticleEffect() actually returns an instance of CNewParticleEffect, which has a variety of methods for controlling the particle system, including control point definitions via CNewParticleEffect:AddControlPoint(): https://wiki.facepunch.com/gmod/CNewParticleEffect:AddControlPoint

The indices of the control points are now explicitly specified in the first argument of the aforementioned method, rather than implicitly derived from the indices of the table formerly passed in the second argument of the original function.


Here's an example from some of my tests that may prove useful:

THIS:
local CPoint0 = {
["entity"] = entity1,
["attachtype"] = PATTACH_ABSORIGIN_FOLLOW,
}
local CPoint1 = {
["entity"] = entity2,
["attachtype"] = PATTACH_ABSORIGIN_FOLLOW,
}
entity1:CreateParticleEffect("medicgun_beam_red",{CPoint1,CPoint0})


Must become, THIS:
local pfx = entity1:CreateParticleEffect("medicgun_beam_red",0)
pfx:AddControlPoint(0, entity1,PATTACH_ABSORIGIN_FOLLOW)
pfx:AddControlPoint(1, entity2,PATTACH_ABSORIGIN_FOLLOW)



Hope that helps someone!

I see.
This mod hasn't been updated since 2017, so the code this addon uses seems to be obsolete. I'm not a coding expert, btw.
Last edited by NegativThousandDegrees; Nov 12 @ 12:47am
I am having issues with this as well, this needs an update.
no loafing  [developer] 11 hours ago 
Should be fixed now, let me know if there's still problems.
< >
Showing 1-7 of 7 comments
Per page: 1530 50