Each particle system in Dota is designed for a certain purpose, for example:
- Buff/Debuff or Ambient effect
- Explosions and other limited-time effects
- Circle AoE Indicators
- Line Indicators
- Projectiles (Linear or Tracking)
When attempting to use some of the available particles, keep in mind what was the original behavior of it.
For example if you try to use a projectile particle as a buff, or an explosion as a projectile, you will get disastrous or just no effect at all.
You can browse particles in the asset browser, for filtering just write keywords like "particle" or "vpcf".
Also every time you use a particle, remember to add them in a datadriven precache block on the ability:
Else you won't see them unless they belonged originally to the hero that is casting them.
Parents and Childs
A Parent Particle is indicated by a P in the Asset Broswer.
You normally want to use a Parent because it will show the complete particle effect. Childs are harder to display and might not show or display properly.
Copy this entire path for the particleName
Particles need to be Attached to some entity location to begin its behavior.
This can be as easy as a single
"Target" "TARGET" line, or contain many weird attach points that you will need to discover through numerous trial and error attempts.
Here is a list of every attach type, in order of importance/relevance.
|PATTACH_ABSORIGIN_FOLLOW||follow_origin||Follows the movement of the target at its origin location|
|PATTACH_OVERHEAD_FOLLOW||follow_overhead||Follows the movement of the target over its head|
|PATTACH_ABSORIGIN||attach_origin||Starts at the origin of the target and stays there|
|PATTACH_POINT||attach_hitloc||Normally the body of the model, where the attack projectiles hit|
|PATTACH_POINT_FOLLOW||follow_hitloc||Follows the body|
|PATTACH_CUSTOMORIGIN||start_at_customorigin||Enables the attachment to a custom origin|
|PATTACH_CUSTOMORIGIN_FOLLOW||follow_customorigin||Follow the movement of the custom origin set|
|PATTACH_WORLDORIGIN||world_origin||Targets a Point entity in the world, use with "TargetPoint" key|
|PATTACH_EYES_FOLLOW||follow_eyes||Fills the screen, used for the damage stun or arcana drop indicator.|
|Attach to an specific bone||attach_attack1||You can check these by opening the hero VMDL file in the Model Editor.|
Basically the engine will try to find the "bone" or attach point and type of the constant/string used, if the model has it and the particle is designed to properly attach to that point you will get a nice behavior.
Numerous times when dealing with complex particle systems you will get errors like:
- Particle childs showing at the Vector (0,0,0).
- This is what normally happens when you miss a Control Point (explained later)
- Effect appearing in a different position than expected.
- Wrong attachment or particle can't attach that place.
Control points are x,y,z values that are used to set the particle to a target entity location or a vector for radius, color, duration, speed, etc.
It's easier to understand them with examples, so we'll move through some basic particles that don't need specific control points and then see some that need them to display properly.
With Reborn, now the default dota particles can be opened directly with the Particle Editor and make copies of them. Read more about this on the wiki in Particle Copy Tool
1. Simple buff particles, datadriven
This type of particles is the easiest to attach. They are tied to a modifier and automatically stop after the modifier is destroyed.
For this to, the particle system duration usually needs to be infinite, designed as a simple buff, internally they have a single control point which is set with the
Status Effects are a particular type of particle that is generally applied to change the texture color of the hero, for things like illusions, ghosts, etc.
2. Basic attachment
When you want more than one particle attached to a modifier or the particle needs additional control points, you need to do it in a
"AttachEffect" block instead.
"Target" uses the same target rules as any datadriven block
3. Control Points
When the easy attachment procedure fails, it means the particle has Control Points to control certain properties like radius, position of multiple elements, color, etc.
To know what each CP controls, you need to open the particle in the Particle Editor. Now you will be able to double click any of the copied particles in the Asset Browser and try to understand how to set each CP
Control Points can be either set in the datadriven
"AttachEffect" or in lua.
Doing it in Lua has the advantage that you can dynamically reload the control points by doing script_reload after changing the code.
3.1 Lua Particle Attachment with
CP0 is not really needed (because this type of attachment already sets the particle to follow the AbsOrigin) but its nice to have.
CP1.x controls the radius of the particle, as seen in the Particle Editor after playing around with the values
Hovering over the button tells us its a "Position along ring"
In this particular case, we are using
CreateParticleForPlayer to only display it to one particular player. Could also use PATTACH_OVERHEAD_FOLLOW
The same can be translated to datadriven, except if you need the control points to be decided at runtime (like, doing a radius * some variable)
Keep in mind that a
"AttachEffect" action can be inside any Ability or Modifier Event, not only on the
"OnDestroy" Modifier Events.
4. Control Point Entities
Some times, particle attach points can get even more complicated when they need to be attached on specific locations or entities. If your attachment is not working with the simple lua method, you need to try the next level of control point setup, the Control Point Entities, in either Lua or Keyvalues.
Example: This is the proper lua attachment for Abaddon Aphotic Shield Particle:
PATTACH_POINT_FOLLOW puts the particle at the targets body in this case. PATTACH_ABSORIGIN_FOLLOW will put it at its feet, and PATTACH_OVERHEAD_FOLLOW at its head.
Note the partice being defined under the
target. handle, this is because we will need to destroy it later in Lua, becase attaching a particle this way
will not stop the particle effect by itself after the modifier is destroyed, as we are just tying the particle to a target.
This is not a concern if the particle is meant for a short duration (unlike the buff particles that last forever until removed)
This works by setting each CP in order to its key. If you need to set the CP8 to a Targets hitloc, you need 8 "TARGET" (or "CASTER" or anything) lines.
ControlPointEntities is the hardest method of Particle Attachment. Use it with caution and pride.
5. Stopping a Lua Particle
If the entity dies, it will normally destroy the particle.
To stop something like we created in the Aphotic Shield example, add a
"OnDestroy" of the modifier with a RunScript that calls something like this:
If the particle has a fixed duration you can also easily use BMD Timers:
6. Difference between "FireEffect" and "AttachEffect"
When used inside a modifier, AttachEffect will automatically stop the particle after the modifier is destroyed, while FireEffect won't (if the particle duration is infinite)
FireEffect is pretty much the same as doing the lua
ParticleManager:CreateParticle in this sense.
So if you FireEffect with a particle of infinite duration inside a modifier, it will still live after the modifier ends.
If the particle duration has a short duration, using any of the 2 Effect actions has the same results.
7. Projectile Particles
There are two types of projectile particles: Linear and Tracking.
Linear follow a straight line and collide with anything in its path.
"DeleteOnHit" "0" inside the
"OnProjectileHitUnit" Ability Event if you want them to continue going up to its fixed distance.
Tracking can curve and follow a target movement. Every ranged attack particle is of this type.
Note: You can't generally use a particle designed to be Linear in a Tracking action and vice versa.
You might be able to mimic a Linear behavior using a Tracking projectile if you make it to track a dummy unit that can't move, but you need another invisible Linear projectile to do the hit effects.