Particles In Animations: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
(12 intermediate revisions by 7 users not shown)
Line 4: Line 4:
  { event AE_CL_CREATE_PARTICLE_EFFECT <frame number> "<particle effect name> <attachment type> <attachment point>" }
  { event AE_CL_CREATE_PARTICLE_EFFECT <frame number> "<particle effect name> <attachment type> <attachment point>" }


The '''<particle effect name>''' must match the name of one of the .pcf files in your ''game/particles'' directory.
;<code><particle effect name></code>
:Must match the name of one of the [[PCF]] files in the <code>particles/</code> directory.
;<code><attachment type></code>
:Must match one of the valid attachment types. These are:
:<code>start_at_origin</code>
::The particle effect is created at the [[origin]] of the entity it's attached to. The effect doesn't move.
:<code>start_at_attachment</code>
::The particle effect is created on an [[attachment]] point on the entity it's attached to. The effect doesn't move.
:<code>follow_origin</code>
::The particle effect is created at the origin of the entity it's attached to. The effect is updated to move with the entity's origin.
:<code>follow_attachment</code>
::The particle effect is created on an attachment point on the entity it's attached to. The effect is updated to move with the attachment point.
;<code><attachment point></code>
:Must match the name of an attachment point in the model. This field is only needed if <code><attachment type></code> is one that uses an attachment point.
 
 
== Stopping Particle Effects ==
Similar to '''AE_CL_CREATE_PARTICLE_EFFECT''', the .qc code for this is as follows:
 
{{asw||2}} and later games:
{ event AE_CL_STOP_PARTICLE_EFFECT <frame number> "<particle effect name> <boolean>" }
 
older games (note the different name!)
 
{ event AE_CL_REMOVE_PARTICLE_EFFECT <frame number> "<particle effect name> <attachment name>" }
 
;<code><frame number></code>
:Frame number in the sequence smd that the particle is desired to be destroyed/stopped at.
;<code><particle effect name></code>
:The particle effect that you want to destroy/stop.
 
{{asw||2}} and later games:
;<code><boolean></code>
:Whether or not to stop instantly.
 
older games:
 
;<code><attachment name></code>
:Only particles attached to this attachment will be stopped. Ignored if set to "0"
 
'''Example of use:'''
 
$sequence shoot "shoot" fps 30.00 {
{ event AE_CL_CREATE_PARTICLE_EFFECT 34 "weapon_muzzle_flash_assaultrifle_c1 follow_attachment muzzle_flash" }
{ event AE_CL_STOP_PARTICLE_EFFECT 81 "weapon_muzzle_flash_assaultrifle_c1 1" }
}
 


The '''<attachment type>''' must match one of the valid attachment types. These are:
* start_at_origin: The particle effect is created at the origin of the entity it's attached to. The effect doesn't move.
* start_at_attachment: The particle effect is created on an attachment point on the entity it's attached to. The effect doesn't move.
* follow_origin: The particle effect is created at the origin of the entity it's attached to. The effect is updated to move with the entity's origin.
* follow_attachment: The particle effect is created on an attachment point on the entity it's attached to. The effect is updated to move with the attachment point.


The '''<attachment point>''' must match the name of an attachment point in the model. This field is only needed if the '''<attachment type>''' is one that uses an attachment point.


[[Category:Particle System]]
[[Category:Particle System]]
[[Category:Modeling]]

Latest revision as of 07:16, 29 September 2023

Particle Effects can be created in animations by using an anim event. Particle effects specified in this manner will be created every time the entity fires that anim event. So if you really want a single particle effect that keeps pumping out particles over time, you want to specify the effect in the model instead.

The anim event is AE_CL_CREATE_PARTICLE_EFFECT. It takes a string parameter that contains the particle effect options, separated by spaces. So, the .qc entry format for this particle effect is as follows:

{ event AE_CL_CREATE_PARTICLE_EFFECT <frame number> "<particle effect name> <attachment type> <attachment point>" }
<particle effect name>
Must match the name of one of the PCF files in the particles/ directory.
<attachment type>
Must match one of the valid attachment types. These are:
start_at_origin
The particle effect is created at the origin of the entity it's attached to. The effect doesn't move.
start_at_attachment
The particle effect is created on an attachment point on the entity it's attached to. The effect doesn't move.
follow_origin
The particle effect is created at the origin of the entity it's attached to. The effect is updated to move with the entity's origin.
follow_attachment
The particle effect is created on an attachment point on the entity it's attached to. The effect is updated to move with the attachment point.
<attachment point>
Must match the name of an attachment point in the model. This field is only needed if <attachment type> is one that uses an attachment point.


Stopping Particle Effects

Similar to AE_CL_CREATE_PARTICLE_EFFECT, the .qc code for this is as follows:

Alien Swarm and later games: { event AE_CL_STOP_PARTICLE_EFFECT <frame number> "<particle effect name> <boolean>" }

older games (note the different name!)

{ event AE_CL_REMOVE_PARTICLE_EFFECT <frame number> "<particle effect name> <attachment name>" }

<frame number>
Frame number in the sequence smd that the particle is desired to be destroyed/stopped at.
<particle effect name>
The particle effect that you want to destroy/stop.

Alien Swarm and later games:

<boolean>
Whether or not to stop instantly.

older games:

<attachment name>
Only particles attached to this attachment will be stopped. Ignored if set to "0"

Example of use:

$sequence shoot "shoot" fps 30.00 {
{	event AE_CL_CREATE_PARTICLE_EFFECT 34 "weapon_muzzle_flash_assaultrifle_c1 follow_attachment muzzle_flash" }
{	event AE_CL_STOP_PARTICLE_EFFECT 81 "weapon_muzzle_flash_assaultrifle_c1 1" }
}