game/AddParticles

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{Func |Name=AddParticles |Parent=game |Description=Loads a particle file. |Realm=Client |IsClass=No }} {{Arg |type=string |name=particleFileName |desc=The path of th...")
 
(Better example)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=AddParticles
 
|Parent=game
 
 
|Description=Loads a particle file.
 
|Description=Loads a particle file.
|Realm=Client
+
 
 +
{{Note|You will still need to call this function clientside regardless if you create the particle effects serverside.}}
 +
|Realm=Shared
 
|IsClass=No
 
|IsClass=No
 
}}
 
}}
Line 9: Line 9:
 
|type=string
 
|type=string
 
|name=particleFileName
 
|name=particleFileName
|desc=The path of the file to add.
+
|desc=The path of the file to add. Must be (file).pcf.
 +
}}
 +
{{Example
 +
|Description=Example usage of the function. Precaches "ExplosionCore_wall" particle from "particles/explosion.pcf", a Team Fortress 2 particle file.
 +
 
 +
You can find a list of particles inside a .pcf file using the [https://developer.valvesoftware.com/wiki/Particle_Editor Particle Editor Tool]
 +
|Code=game.AddParticles( "particles/explosion.pcf" )
 +
PrecacheParticleSystem( "ExplosionCore_wall" )
 +
 
 +
if ( SERVER ) then
 +
-- A test console command to see if the particle works, spawns the particle where the player is looking at.
 +
concommand.Add( "particleitup", function( ply, cmd, args )
 +
ParticleEffect( "ExplosionCore_wall", ply:GetEyeTrace().HitPos, Angle( 0, 0, 0 ) )
 +
end )
 +
end
 
}}
 
}}

Latest revision as of 00:34, 20 September 2018

 game.AddParticles( )

Contents

Description

Loads a particle file.

NOTE

You will still need to call this function clientside regardless if you create the particle effects serverside.

Arguments

string particleFileName

The path of the file to add. Must be (file).pcf.

Examples

Example

Example usage of the function. Precaches "ExplosionCore_wall" particle from "particles/explosion.pcf", a Team Fortress 2 particle file.

You can find a list of particles inside a .pcf file using the Particle Editor Tool

game.AddParticles( "particles/explosion.pcf" )
PrecacheParticleSystem( "ExplosionCore_wall" )

if ( SERVER ) then
	-- A test console command to see if the particle works, spawns the particle where the player is looking at. 
	concommand.Add( "particleitup", function( ply, cmd, args )
		ParticleEffect( "ExplosionCore_wall", ply:GetEyeTrace().HitPos, Angle( 0, 0, 0 ) )
	end )
end


Personal tools
Navigation