Garry's Mod

Garry's Mod

Advanced Particle Controller
[OBSOLETE, IGNORE] A lot of people (including me) are having this error
This problem has been fixed, so it's best to ignore this discussion. 11/15/2025


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.
最后由 NegativThousandDegrees 编辑于; 11 月 14 日 下午 5:03
< >
正在显示第 1 - 9 条,共 9 条留言
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.
MrNiceGuy518 11 月 11 日 下午 3:12 
Indeed, this broke several addons, including mine, the Team Fortress 2 Bots. Looks like this is a pretty widespread issue.
MrNiceGuy518 11 月 11 日 下午 3:35 
引用自 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
引用自 MrNiceGuy518
引用自 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.
最后由 NegativThousandDegrees 编辑于; 11 月 12 日 上午 12:47
Retroburger1984 11 月 13 日 上午 6:24 
I am having issues with this as well, this needs an update.
no loafing  [开发者] 11 月 13 日 下午 1:23 
Should be fixed now, let me know if there's still problems.
引用自 no loafing
Should be fixed now, let me know if there's still problems.
Thanks for finding this out! It has been fixed.
最后由 NegativThousandDegrees 编辑于; 11 月 14 日 下午 5:01
I retitled the discussion so everyone should ignore it now.

I think this mod was indeed broken from the GMod update since I am on the x86-64 branch, which is one of the many branches that test out upcoming major updates every few months or so. Thanks to my effort and the creator, it has been fixed since November 15th.
最后由 NegativThousandDegrees 编辑于; 11 月 14 日 下午 5:29
< >
正在显示第 1 - 9 条,共 9 条留言
每页显示数: 1530 50