# How do I create an actor class in UDK that will spawn a specific particle system?

I'm trying to write a new class that I can drag from actor classes window into the scene and it will spawn a specific particle effect. Its going to be a 'prop' that later will also contain a static mesh and a point light. Maybe some defined variables that can be changed in the properties window. So far, I have the static mesh working using this code:

class LightFixture extends StaticMeshActor;

defaultproperties
{
Begin Object Class=StaticMeshComponent Name=myMesh
bAllowApproximateOcclusion=TRUE
bForceDirectLightMap=TRUE
StaticMesh=StaticMesh'props.Meshes.lamp'
End Object

}


now, I'd like to add a particle system (template?), and from what I'm learning, it's not as easy as adding the mesh. In a new class, I tried to add a particle effect this way:

class FireParticle extends EmitterPool
placeable;

var ParticleSystemComponent PSC;

defaultproperties
{
Begin Object Class=ParticleSystemComponent Name=myEffect
bAutoActivate=true
Template=ParticleSystem'props.FX.fire'
End Object

ParticleSystemComponent=myEffect
}


So that didn't work... I read somewhere that emitterpool was the way to spawn.. I am very new to scripting, if that isn't already obvious :)

thanks in advance, if anyone can help..

The EmitterPool is a manager class that you can use to spawn temporary emitters. You would do this by calling WorldInfo.MyEmitterPool.SpawnEmitter(...). For permanent emitters, you just need a ParticleSystemComponent variable in your actor set up basically exactly like you're doing.

So the main problem is that EmitterPool is defined in such a way that you can't place it (or subclasses of it) within the editor. You need to make your FireParticle class derive directly from Actor. Secondly, you need to change ParticleSystemComponent=myEffect to PSC=myEffect, so you assign it to your variable. With those two changes, you should be good to go.

Create a class something like this:

class MyParticleActor extends Actor placeable;

var ParticleSystemComponent ThePausePSC;

simulated event PostBeginPlay(){
super.PostBeginPlay();
ActivateMyPSC();
}

simulated function ActivateMyPSC(){
if(ThePausePSC != none){
ThePausePSC.SetScale(20.f);
ThePausePSC.CustomTimeDilation = 0.25f;
ThePausePSC.ActivateSystem();
}
}

simulated function DeactivateMyPSC(){
if(ThePausePSC != none){
ThePausePSC.DeactivateSystem();
}
}

defaultproperties
{
Begin Object Class=ParticleSystemComponent Name=ThePauseParticleEffectSystemComponent
Template=ParticleSystem'Eagle.Effects.PE_RobotPause';
bAutoActivate=false
bOwnerNoSee=true
Scale=10.f
Translation=(X=0.f,Y=0.f,Z=0.f)
End Object
ThePausePSC=ThePauseParticleEffectSystemComponent

Begin Object Class=SpriteComponent Name=Sprite44
Sprite=Texture2D'EditorResources.Crowd.T_Crowd_Destination'
HiddenGame=true
HiddenEditor=false