Global/ParticleEffectAttach

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
 
Line 25: Line 25:
 
|name=attachmentID
 
|name=attachmentID
 
|desc=The id of the attachment to be used in the way specified by the attachType.
 
|desc=The id of the attachment to be used in the way specified by the attachType.
 +
}}
 +
{{Example
 +
|Description=A console commands that attaches a "Rocket_Smoke" particle effect from "particles/rocket_fx.pcf" to the entity the player is looking at.
 +
|Code=game.AddParticles( "particles/rocket_fx.pcf" )
 +
PrecacheParticleSystem( "Rocket_Smoke" )
 +
 +
if ( SERVER ) then
 +
-- A test console command to see if the particle works, attaches the particle to the entity the player is looking at.
 +
concommand.Add( "particle_attach", function( ply, cmd, args )
 +
local tr = ply:GetEyeTrace()
 +
ParticleEffectAttach( "Rocket_Smoke", PATTACH_ABSORIGIN_FOLLOW, tr.Entity, 0 )
 +
end )
 +
end
 
}}
 
}}

Latest revision as of 17:28, 15 January 2020

 ParticleEffectAttach( )

Contents

Description

Creates a particle effect with specialized parameters.

NOTE

The particle effect must be precached with PrecacheParticleSystem and the file its from must be added via game.AddParticles before it can be used!

Arguments

string particleName

The name of the particle effect.

Arguments

number attachType

Attachment type using PATTACH_ Enums.

Arguments

Entity entity

The entity to be used in the way specified by the attachType.

Arguments

number attachmentID

The id of the attachment to be used in the way specified by the attachType.

Examples

Example

A console commands that attaches a "Rocket_Smoke" particle effect from "particles/rocket_fx.pcf" to the entity the player is looking at.

game.AddParticles( "particles/rocket_fx.pcf" )
PrecacheParticleSystem( "Rocket_Smoke" )

if ( SERVER ) then
	-- A test console command to see if the particle works, attaches the particle to the entity the player is looking at.
	concommand.Add( "particle_attach", function( ply, cmd, args )
		local tr = ply:GetEyeTrace()
		ParticleEffectAttach( "Rocket_Smoke", PATTACH_ABSORIGIN_FOLLOW, tr.Entity, 0 )
	end )
end


Personal tools
Navigation