Gah - a solution with more questions. – EntropicLqd


From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT2004 :: Actor >> Emitter >>SFXSelfScaling(Package: custom)

by VitalOverdose


This custom Emitter class that will alter its particle size depending on the Drawscale of its Owner.Whatever spawns the Emitter has to Set it's Owner to whatever it wants the Emitter to base is scale on. This is great for explosion fx on things like simulating exploding staticmeshes in a level. The mapper is able to rescale the mesh without having to worry about having to make a special emitter scaled correctly just to fit the new size of the mesh.

Also the Velocity of the particles is altered to match the owners size.

This script works with MeshEmitters as well as SpriteEmitters.


-The Drawscale is gained in function Postbeginplay() from the emitters owner.-

-A ForLoop is used to cycle through the Emitters belonging to this emitter actor and use the looking for mesh emitters and sprite emitters. When found the StartSizeRange for that emitters is multiplied by the drawscale gained in Function PostBeginPlay()which results in scaled particles.-

Note:For sprite emitter only the X value has to be altered as sprites are scaled uniformly from a single value.

The full script.[edit]

// SelfScalingFx - Emitter Fx that changes the Size of the startSize.
// range and velocity of the emitted particles based on the drawscale of its 'base'.
// Full class list's_Pro_Mapping_Tools.
// Direct Download the Mod in zipped format Http:// .
class SelfScaling_Fx Extends Emitter
function PostBeginPlay()
Simulated function ProcessScale(Float NewScale)
 Local int I;
 for ( I=0 ; I <Emitters.Length; I++ )
      Emitters[I].StartVelocityRange.X.Min *= NewScale;       // Change X Velocity
      Emitters[I].StartVelocityRange.x.Max *= NewScale;       // Change X Velocity
      Emitters[I].StartVelocityRange.y.Min *= NewScale;       // Change y Velocity
      Emitters[I].StartVelocityRange.y.Max *= NewScale;       // Change y Velocity
      Emitters[I].StartVelocityRange.z.Min *= NewScale;       // Change z Velocity
      Emitters[I].StartVelocityRange.z.Max *= NewScale;       // Change z Velocity
      Emitters[I].StartSizeRange.X.Min     *= NewScale;       // Change X Scale
      Emitters[I].StartSizeRange.X.Max     *= NewScale;       // Change X Scale
      if ( Emitters[I].Class == Class'meshEmitter')
          Emitters[I].StartSizeRange.y.Min *= NewScale;        // Change Y
          Emitters[I].StartSizeRange.y.Max *= NewScale;        // Change Y
          Emitters[I].StartSizeRange.z.Min *= NewScale;        // Change Z
          Emitters[I].StartSizeRange.z.Max *= NewScale;        // Change Z

Related Topcs[edit]

More custom emitter scripts[edit]


EricBlade: This is a great little add-on. I have used a code similar to this, along with some custom mods to the default Fire classes, to create a fire that slowly spreads out and consumes everything it can reach that's consumable. :)

VitalOverdose Thats great. I did set out to make Spreadable fire one time but i couldn't decide on how to make it look right and the conditions of how to make it spread. Id be interested to see how you did it.

EricBlade: Well, i'm currently using Land of the Dead's default fire emitter, so it's not exactly the greatest looking.. basically what I've got is any object that is burnable will have an IgnitionTime, and if there's a fire that burns it for it's IgnitionTime seconds, then the fire will spawn a new fire. If an object is on fire for it's IgnitionTime, it will increase the scale of the existing fire, if it's not spreading somewhere. It's not bad, unless you put a fire next to an object that you accidently set with an IgnitionTime, but didn't set a Health on, so it burns forever .. increasing in size :D Now, I'm revisiting this class to see if I can figure out a way to rescale a breaking glass emitter, so I can have glass shattering that fits the size of the window .. *wonder if it's possible to get an objects X and Y dimensions*

VitalOverdose Im not sure. If not you could try making a SheetofGlass actor that hides itself and spawns an emitter on contact (rather like an exploding barrel), the mapper could set the x and y dimensions for the glass when he assigns an emitter class to the glass in unrealed. Have a look at Dynamic_Emitter_Control for some handy Emitter scaling functions.You can do the automatic rescaling of the particles using the functions MeasureTileU() together with function PartScale().