• Effects/particles
    20 replies, posted
I'm trying to attach a particle effect to a player. Here's what I got so far: [lua] game.AddParticles( PrecacheParticleSystem("superrare_burning1") function DrawParticle(ply) local offset = Vector(0, 0, 79) local ang = LocalPlayer():EyeAngles() local pos = ply:GetPos() + offset + ang:Up() ang:RotateAroundAxis(ang:Forward(), 90) ang:RotateAroundAxis(ang:Right(), 90) cam.Start3D2D(pos, Angle(0, ang.y, 90), 0.1) ParticleEffect( "superrare_burning1", Vector (0, 0, 0), Angle( 0, 0, 0), ply) cam.End3D2D() end [/lua] Now it does create the particle effect, [B]but[/B] spams this: [code] Attempting to create unknown particle system 'superrare_burning1' [/code] I've read of [URL="http://wiki.garrysmod.com/page/game/AddParticles"]game.AddParticles[/URL] but for the love of god for the past 2 hours I've been trying to find what's the PCF that the particle is in, no luck. (It's used in TF2) Anyone has any idea? Also am I using the whole thing right? Never used particles. Another random question, do the particles work like materials where if the player doesn't have it downloaded then it'd be an error for them? (in this case red crosses)
The code you posted won't even work, it will throw an error. If you are having trouble fining the .pcf your effect is in, you can try this: Open all PCFs in NP++ and seach all files for it's name Just include all the files using a for loop, it will increase load times, but who cares.
This isn't really the exact code but do you mind telling me why it won't work? It doesn't seem to throw an error for me and rather attempts to create the particle. I guess I'll just use GCF viewer and NP++ and see what goes where, thanks!
It's itemfx.pcf.
That particular code will error on first line because of missing "myparticle")
@Karmal thanks @Robot oh yeah sorry about that, it's not in the actual code I just was typing it in and came up with the pcf problem. Thanks to both! [editline]18th October 2013[/editline] So I'm back, this doesn't seem to work. Still spamming me with "Missing particle" [lua] game.AddParticles("itemfx.pcf") PrecacheParticleSystem("superrare_burning1") function DrawParticle(ply) local offset = Vector(0, 0, 79) local ang = LocalPlayer():EyeAngles() local pos = ply:GetPos() + offset + ang:Up() ang:RotateAroundAxis(ang:Forward(), 90) ang:RotateAroundAxis(ang:Right(), 90) cam.Start3D2D(pos, Angle(0, ang.y, 90), 0.1) ParticleEffect( "superrare_burning1", Vector (0, 0, 0), Angle( 0, 0, 0), ply) cam.End3D2D() end [/lua] Anyone has any ideas what I'm doing wrong?
[QUOTE=arcaneex;42568421]@Karmal thanks @Robot oh yeah sorry about that, it's not in the actual code I just was typing it in and came up with the pcf problem. Thanks to both! [editline]18th October 2013[/editline] So I'm back, this doesn't seem to work. Still spamming me with "Missing particle" [lua] game.AddParticles("itemfx.pcf") PrecacheParticleSystem("superrare_burning1") function DrawParticle(ply) local offset = Vector(0, 0, 79) local ang = LocalPlayer():EyeAngles() local pos = ply:GetPos() + offset + ang:Up() ang:RotateAroundAxis(ang:Forward(), 90) ang:RotateAroundAxis(ang:Right(), 90) cam.Start3D2D(pos, Angle(0, ang.y, 90), 0.1) ParticleEffect( "superrare_burning1", Vector (0, 0, 0), Angle( 0, 0, 0), ply) cam.End3D2D() end [/lua] Anyone has any ideas what I'm doing wrong?[/QUOTE] 'Scuse me, swap itemfx.pcf with item_fx.pcf.
Same thing, sadly. edit:I know it actually draws it where it needs to be (above the players head), because if I'm in firstperson it doesn't spam that Missing particle missing, whenever I go thirdperson it starts spamming it.
Not sure whether that has changed or not, but a while ago I had to load and precache the particle system on both the server and the client in order to get rid of that error. I know it doesn't make sense. But that seemed to fix it.
Precached it again in a shared file, still a nope.
1) Why the hell are you trying to attach a particle inside a cam2d3d? 2) You seem to be creating the particle EVERY FRAME 3) You sure TF2 is mounted and is working? 4) Try adding ALL pcfs 5) Try using built-in particles ( See emitter tool source code ) [editline]19th October 2013[/editline] 6) Try not only precaching the effect, but also game.AddParticle it.
1) I have no idea? I'm trying to for it to display it above a players head. (It's supposed to be a pointshop item) 2) How would I then create it only once and make it loop through it (like any TF2 unusual)? [IMG]http://i991.photobucket.com/albums/af35/tweezzzy/TF2%20Unusual%20Gallery/d9ad0d04.gif[/IMG] 3)Very sure 4) Will get back to you about that 5) Not the brightest guy out there, all I found in the source is that it spawns an entity and sets its effect based on what the player chose. 6) I already have the game.AddParticle, unless you mean putting it in shared/serverside which I already tried, didn't work EDIT: Not sure how to do 4, sorry. Mind guiding me through it? [editline]19th October 2013[/editline] So I got it to work! My only question now, is it possible to set a "ParticleEffectAttach" position but still follow something or get to whom it's attached to then not draw it to that person?
I ended up making this for a friend: [lua] game.AddParticles("particles/item_fx.pcf") ITEM.Name = 'Afro - Unusual Bubbles' ITEM.Price = 200 ITEM.Model = 'models/dav0r/hoverball.mdl' ITEM.Attachment = 'eyes' ITEM.Particle = "unusual_bubbles" PrecacheParticleSystem(ITEM.Particle) function ITEM:OnEquip(ply, modifications) ply:PS_AddClientsideModel(self.ID) ParticleEffectAttach(self.Particle, PATTACH_POINT_FOLLOW, ply, ply:LookupAttachment("eyes")) end function ITEM:OnHolster(ply) ply:PS_RemoveClientsideModel(self.ID) ply:StopParticles() end function ITEM:ModifyClientsideModel(ply, model, pos, ang) model:SetModelScale(1.6, 0) model:SetMaterial('models/weapons/v_stunbaton/w_shaft01a') pos = pos + (ang:Forward() * -7) + (ang:Up() * 8) ang:RotateAroundAxis(ang:Right(), 90) return model, pos, ang end [/lua] To stop it from drawing on the LocalPlayer(), you can just call Player:StopParticles() on that players client using SendLua or the net library.
I've thought of that but won't it stop all the particles, including particles on other players?
[QUOTE=arcaneex;42571160]I've thought of that but won't it stop all the particles, including particles on other players?[/QUOTE] Just loop through everyone on the client and stop the particles.
[QUOTE=brandonj4;42571628]Just loop through everyone on the client and stop the particles.[/QUOTE] He's asking if it WOULD. He wants to know if sending that command would disable particles on JUST that hat, or would it disable it on EVERY hat, including other player's hats.
[QUOTE=arcaneex;42571160]I've thought of that but won't it stop all the particles, including particles on other players?[/QUOTE] No, as you can see it's "ply:StopParticles()" meaning it only works on the player not the whole servers. Thank you brandon! Did you make this for Led Zeppelin, or did he just find it somewhere? :p
[QUOTE=IGRed;42571711]No, as you can see it's "ply:StopParticles()" meaning it only works on the player not the whole servers. Thank you brandon! Did you make this for Led Zeppelin, or did he just find it somewhere? :p[/QUOTE] I was the one who made it for him, I thought I told you that yesterday! [editline]18th October 2013[/editline] [QUOTE=Ghost_Sailor;42571641]He's asking if it WOULD. He wants to know if sending that command would disable particles on JUST that hat, or would it disable it on EVERY hat, including other player's hats.[/QUOTE] It would disable all the particles on that specific player. So if you send it to the person wearing the hat and make their particles stop on the LocalPlayer(), the LocalPlayer() won't be able to see the particle effects, but everybody else can.
Call me a retard and shower me with boxes, I cannot seem to figure out how to successfully do this. I have a thirdperson function, toggles between each mode with a convar. Is it somehow possible to get what particle the player has quipped, if he does have it equipped and is in thirdperson then draw it to him, otherwise don't. What I have right now is detecting if the player is in thirdperson or not on spawn, if he is then enable particle, otherwise disable it. If he is was in thirdperson and the particle got enabled and he switched to first person, it disables it. One small problem though, it doesn't activate it again if I go to thirdperson. Any input is appreciated, it looks like the ITEM:Equip function is called only a few times, on spawn and when an item refreshes. I'll look into pointshop files see if I can trigger it as soon as the convar changes, but I'm still pretty new and doubt I'll make it. I tried the net library, but it was a total mess and it failed. This is inside the ITEM:Equip function of the item [lua] if GetConVar("thirdperson_active"):GetBool() then ParticleEffectAttach("unusual_storm", PATTACH_POINT_FOLLOW, ply, ply:LookupAttachment("eyes")) else ply:PS_Notify("The particle Unusual storm was disabled because you're in first person.") end [/lua] Third person function, that's where I toggle between it [lua] ThirdpersonDisabled = true hook.Add( "Think","Thirdperson toggle",function() if input.IsKeyDown(KEY_R) and input.IsKeyDown(KEY_E) and ThirdpersonDisabled then if tpvar:GetBool() then ThirdpersonDisabled = false RunConsoleCommand("thirdperson_active", "0") LocalPlayer():StopParticles() timer.Simple( 4, function() ThirdpersonDisabled = true end) else ThirdpersonDisabled = false RunConsoleCommand("thirdperson_active", "1") timer.Simple( 4, function() ThirdpersonDisabled = true end) end end end) [/lua]
Solved! Thanks for the help, everyone!
Great, we know how you did it!
Sorry, you need to Log In to post a reply to this thread.