| Home Page | Recent Changes

VitalOverdose/SFX SelfScaling

UT2004 :: Actor >> Emitter >>SFX_SelfScaling(Package: custom)
 

by VitalOverdose

Part of Vital'sPMT

Overview

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

Also the velocity of the particles is alterd to match the owners size.

This works with MeshEmitters as well as Sprite emitters.

Method

-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.

Here is the completed script;-

//==================================================
// 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 http://wiki.beyondunreal.com/wiki/Vital's_Pro_Mapping_Tools.
// Direct Download the Mod in zipped format Http://promappingtools.zapto.org .
//==================================================

class SelfScaling_Fx Extends VitalFx
placeable;

function PostBeginPlay()
{
 ProcessScale(owner.Drawscale);
 super.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 Topics

  

Discussion

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 couldnt decide on how to make it look right and the conditions of how to make it spread. Id be intrested 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 dimentions 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().

Category Custom Class

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In