Dear Community,
For some of you this is basic, but I could not find all this info in one place, so I'm making a compilation / tutorial
This tutorial tells you all the steps needed to:
1. set up your particle system to only loop once, and to loop guaranteed at the time of its spawning, and then disappear, as is needed for just about any explosion effect.
2. spawn this explosion/particle system in-game using unrealscript
3. attach particle effect to an actor, so that the actor does not pass through the effect as the actor moves, but instead the effect stays constantly in front so it is fully visible
~~~
Part 1 - Setting Up Your Particle System
Please look elsewhere for how to actually make a Particle System
For each of the components of your particle system,
you must set the Required and Spawn modules as follows:
Required Module
Emitter
Kill on Deactivate = true
kill on Completed = true
Duration
Emitter Duration = small number like 0.1
Emitter Loops = 1
~~~
Spawn Module
Spawn
Rate
constant = 0
Burst
Count = 1 (use green Plus sign to add a value)
Count Low = -1
time = 0 (runs at time 0, which is spawning time of emitter, which we spawn in-game with code)
~~~
Use the Lifetime module to control how long the single cycle of your particle effect lasts
~~~
Once you have your particle system, let's say you've called it: VictoryPackage.Particles.JoyParticle
Find out the unrealscript name of your particle system by right click and selecting "Copy full name to clipboard"
~~~
Part 2 - UnrealScript
Here is the unrealscript!
In whatever class you want to spawn your explosion effect / particle system:
I commented out the local variable because it is not used, but I wanted to show you how you could track the effect you created if you needed to modify it after it spawned.
look at various UTProjectile classes including the link gun to see how you can pass in the HitNormal and HitLocation for events like HitWall.
If you just want to spawn an explosion at a specific location, use
Spawn in Front of object?
What if you want to spawn the explosion in front of the object your projectile hit, you can use something like:
96 could be a variable instead, indicating the distance to spawn in front of the object, based on the angle at which the projectile hit the surface.
3. Attach to an actor
the final parameter of the spawning function allows you to attach the particlesystem to an actor
make sure that in the UDK particle system editor, for each component
Required Module
use local space = true
(same module as where Kill on Completed is located)
If you want the particle effect to have the same orientation as the actor it is attached to:
use
instead of
add some distance to keep the explosion in front of the actor, you can use actor.GetComponentsBoundingBox or just use a number depending on your needs
Enjoooy!
Let me know if this helps!
♥
Rama
For some of you this is basic, but I could not find all this info in one place, so I'm making a compilation / tutorial

This tutorial tells you all the steps needed to:
1. set up your particle system to only loop once, and to loop guaranteed at the time of its spawning, and then disappear, as is needed for just about any explosion effect.
2. spawn this explosion/particle system in-game using unrealscript
3. attach particle effect to an actor, so that the actor does not pass through the effect as the actor moves, but instead the effect stays constantly in front so it is fully visible
~~~
Part 1 - Setting Up Your Particle System
Please look elsewhere for how to actually make a Particle System
For each of the components of your particle system,
you must set the Required and Spawn modules as follows:
Required Module
Emitter
Kill on Deactivate = true
kill on Completed = true
Duration
Emitter Duration = small number like 0.1
Emitter Loops = 1
~~~
Spawn Module
Spawn
Rate
constant = 0
Burst
Count = 1 (use green Plus sign to add a value)
Count Low = -1
time = 0 (runs at time 0, which is spawning time of emitter, which we spawn in-game with code)
~~~
Use the Lifetime module to control how long the single cycle of your particle effect lasts
~~~
Once you have your particle system, let's say you've called it: VictoryPackage.Particles.JoyParticle
Find out the unrealscript name of your particle system by right click and selecting "Copy full name to clipboard"
~~~
Part 2 - UnrealScript
Here is the unrealscript!
In whatever class you want to spawn your explosion effect / particle system:
I commented out the local variable because it is not used, but I wanted to show you how you could track the effect you created if you needed to modify it after it spawned.
Code:
function createExplosion(vector HitLocation, vector HitNormal){ //local ParticleSystemComponent ProjExplosion; //create explosion //ProjExplosion = WorldInfo.MyEmitterPool.SpawnEmitter( ParticleSystem'VictoryPackage.Particles.JoyParticle', HitLocation, rotator(HitNormal), None); }
look at various UTProjectile classes including the link gun to see how you can pass in the HitNormal and HitLocation for events like HitWall.
If you just want to spawn an explosion at a specific location, use
Code:
createExplosion(LocationForExplosion, rot(0,0,0));
What if you want to spawn the explosion in front of the object your projectile hit, you can use something like:
Code:
HitLocation + HitNormal * 96
3. Attach to an actor
the final parameter of the spawning function allows you to attach the particlesystem to an actor
Code:
WorldInfo.MyEmitterPool.SpawnEmitter(
ParticleSystem'VictoryPackage.Particles.JoyParticle',
HitLocation,
rotator(HitNormal),
YayanActor);
Required Module
use local space = true
(same module as where Kill on Completed is located)
If you want the particle effect to have the same orientation as the actor it is attached to:
use
Code:
YayanActor.Rotation
Code:
rotator(HitNormal)
Code:
HitLocation + Vector(YayanActor.Rotation) * 96;
Let me know if this helps!
♥
Rama
Comment