| Home Page | Recent Changes | Preferences

RetriggerableBreakingGlass

UT :: Actor (UT) >> Effects (UT) >> ExplodingWall >> BreakingGlass >> RetriggerableBreakingGlass (custom)

This special version of the BreakingGlass actor spawns glass fragments every time it is triggered.

To use it, simply create a subclass of the BreakingGlass class, paste the code below, compile changed scripts and follow the Making Glass Break tutorial, except that you use this actor instead of the BreakingGlass class it derives from.

Related Topics

Source Code

//=============================================================================
// RetriggerableBreakingGlass by Wormbo.
// 
// Spawns stuff every time it's triggered.
//=============================================================================
class RetriggerableBreakingGlass extends BreakingGlass;

var int DefaultHealth;

auto state Exploding
{
  function BeginState()
  {
    Super.BeginState();
    DefaultHealth = Health;
  }

  function Explode( pawn EventInstigator, vector Momentum)
  {
    local int i;
    local Fragment s;
    local actor A;

    if( Event != '' )
      foreach AllActors( class 'Actor', A, Event )
        A.Trigger( Instigator, Instigator );

    Instigator = EventInstigator;
    if ( Instigator != None )
      MakeNoise(1.0);
    
    PlaySound(BreakingSound, SLOT_None,2.0);
  
    for (i=0 ; i<NumWallChunks ; i++) 
    {
      s = Spawn( class 'WallFragments',,,Location+ExplosionDimensions*VRand());
      if ( s != None )
      {
        s.CalcVelocity(vect(0,0,0),ExplosionSize);
        s.DrawScale = WallParticleSize;
        s.Skin = WallTexture;
      }
    }
    for (i=0 ; i<NumWoodChunks ; i++) 
    {
      s = Spawn( class 'WoodFragments',,,Location+ExplosionDimensions*VRand());
      if ( s != None )
      {
        s.CalcVelocity(vect(0,0,0),ExplosionSize);
        s.DrawScale = WoodParticleSize;
        s.Skin = WoodTexture;
      }
    }
    for (i=0 ; i<NumGlassChunks ; i++) 
    {
      s = Spawn( class 'GlassFragments', Owner,,Location+ExplosionDimensions*VRand());
      if ( s != None )
      {
        s.CalcVelocity(Momentum, ExplosionSize);
        s.DrawScale = GlassParticleSize;
        s.Skin = GlassTexture;
        s.bUnlit = bUnlitGlass;
        if (bTranslucentGlass) s.Style = STY_Translucent;
      }
    }
    Health = DefaultHealth;
  }
}

Category Class (UT)
Category Custom Class

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

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