• Effect Problem
    7 replies, posted
So I'm trying to make this function that creates a "puke" effect emitting from a players month after entering a command. It seems to be quite hard! I have included this file/code in the init.lua, but when i run the gamemode (and enter the command) i get this error: [code] gamemode\effectsfile.lua:3: attempt to call global 'ParticleEmitter' (a nil value) [/code] [lua] function DoPuke( ply ) local center = ply:GetPos() + Vector(0,0,55) local emitter = ParticleEmitter(center) timer.Simple(10, function() local part = emitter:Add("effects/smoke",ply:GetPos() + Vector(0,0,60)) part:SetVelocity(ply:GetAimVector() * 1000 + Vector(math.random(-50,50),math.random(-50,50),0) ) part:SetDieTime(10) part:SetLifeTime(1) part:SetStartSize(10) part:SetRoll( math.Rand(0, 360) ) part:SetRollDelta( math.Rand(-200, 200) ) part:SetGravity( Vector( 0, 0, -600 ) ) part:SetCollide(true) part:SetEndSize(0) end) emitter:Finish() end concommand.Add( "effect_puke", DoPuke ) [/lua] What am I doing wrong here?
ParticleEmitter is clientside only, I think you may be running it on the server.
[QUOTE=MakeR;16999169]ParticleEmitter is clientside only, I think you may be running it on the server.[/QUOTE] Hem! I got the code on clientside now, and I got no error, but it seems like it's not working. I run the command, nothing happens! Scary! It does not say "unknown command" so i suppose it must be the code.
Is your effect being prechached? (is it in particles_manifest.txt or have you edited it in the particle editor)
[QUOTE=Empty_Shadow;16999591]Is your effect being prechached? (is it in particles_manifest.txt or have you edited it in the particle editor)[/QUOTE] No i have not, how would I do that...?
In your particles folder theres a text file called particles_manifest Open it and add a new line including the Particle file you added.
That's not necessary in Garry's Mod, since it allows sending particle files to clients.
[QUOTE=Overv;17011020]That's not necessary in Garry's Mod, since it allows sending particle files to clients.[/QUOTE] Indeed, I think the problem may be that I'm not creating the effect as an effect file. (like in a gamemode where you would have to create a new scripted effect in the effects folder)... but since i want it to follow the rotation and movement of the player... I can't do that, as far as i know.
Sorry, you need to Log In to post a reply to this thread.