Cogito, ergo sum

Legacy:VitalOverdose/ONSVehicleFXTagger

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

by VitalOverdose

Overview[edit]

A is a modified Decoration that reacts when hit by a vehicle. There is no static mesh for this actor and it wont block the vehicle in any way . When the ONSVehicleFXTagger is triggered it will spawn an emitter and hard attach it to the actor that initiated the event (the vehicle) and any other vehicles inside a radius that can be set by the mapper : TagRadius.

Game use[edit]

This is great for adding realism when a vehicle drives though fire or across lava etc.

The script[edit]

//================================================================================
 
//Class ONSVehicleFXTagger by vitaloverdose Oct2007 http://www.vitaloverdose.com
 
//A modified decoration actor used to attach emitters to vehicles
 
//================================================================================
 
class ONSVehicleFXTagger extends Decoration
 
Placeable;
 
var () class<Actor>               EmitterType;
 
var () float                      TagRadius;
 
var () float                      ResetTime;
 
var () sound                      ResetSoundFX;
 
var    Actor                      SpawnedActor;
 
function Landed(vector HitNormal);
 
function HitWall (vector HitNormal, actor Wall);
 
singular function PhysicsVolumeChange( PhysicsVolume NewVolume );
 
singular function BaseChange();
 
function PostBeginPlay()
 
{
 
super.PostBeginPlay();
 
if ( ResetTime <5 && ResetTime > 0 )
     return;
 
ResetTime = 5;
 
log("the min time allowed for a reset is 5 seconds. -1 shuts the reset off");
 
}
 
function TakeDamage( int NDamage, Pawn instigatedBy, Vector hitlocation,Vector momentum, class<DamageType> damageType)
 
{
 
local ONSVehicle FoundONSVehicle;
 
if ( !bDamageable )
     return;
 
if ( damagetype == None )
     DamageType = class'DamageType';
 
if ( InstigatedBy != None )
     Instigator = InstigatedBy;
 
if ( Instigator != None )
     MakeNoise(1.0);
 
if ( EffectWhenDestroyed != None )
   {
     foreach RadiusActors(Class'ONSVehicle',FoundONSVehicle,TagRadius,location)
             {
              NetUpdateTime = Level.TimeSeconds - 1;
              Spawn( EffectWhenDestroyed, Owner,, FoundONSVehicle.Location );
              SpawnedActor = Spawn( EmitterType, Owner,, FoundONSVehicle.Location );
 
              if (SpawnedActor != none)
                  SpawnedActor.SetBase( FoundONSVehicle );
              }
     }
 
setcollision(false,false,false);
 
if (ResetTime > 0 )
    setTimer(ResetTime,false);
 
}
 
simulated function timer()
 
{
 
Reset();
 
}
 
function Reset()
 
{
 
super.Reset();
 
NetUpdateTime = Level.TimeSeconds - 1;
 
setcollision(true,true,true);
 
if (resetSoundFX != none)
    playsound(ResetSoundFX);
 
}
 
function Bump( actor Other )
 
{
 
if (( Mover(Other) != None && Mover(Other).bResetting ) || Other.IsA('ONSVehicle') == false || ( 
 
VSize(Other.Velocity) < 50 ) )
      return;
 
Instigator = Pawn(Other);
 
if ( Instigator != None && Instigator.Controller != None )
     TakeDamage( VSize(Other.Velocity)*0.03, Instigator, Location, vect(0,0,0), class'Crushed');
 
super.Bump(other);
 
}
 
event EncroachedBy(Actor Other)
 
{
 
if ( Mover(Other) != None && Mover(Other).bResetting )
     return;
 
Instigator = Pawn(Other);
 
if ( Instigator != None && Instigator.Controller != None )
     TakeDamage( 1000, Instigator, Location, vect(0,0,0), class'Crushed');
 
}
 
function bool EncroachingOn(Actor Other)
 
{
 
if ( Mover(Other) != None && Mover(Other).bResetting )
     return false;
 
Instigator = Pawn(Other);
 
if ( Instigator != None && Instigator.Controller != None )
     TakeDamage( 1000, Instigator, Location, vect(0,0,0), class'Crushed');
 
return false;
 
}
 
defaultproperties
 
{
     TagRadius=200.000000
     ResetTime=10.000000
     bDamageable=True
     bStatic=False
     NetUpdateFrequency=1.000000
     AmbientGlow=48
     bMovable=False
     CollisionHeight=50.000000
     bCollideActors=True
     bCollideWorld=True
     bUseCylinderCollision=True
     bEdShouldSnap=True
 
}

SFX Emitters[edit]

The ONSVehicleFXTagger can be used as a 'spawner' for any of the SFX emitter scripts which where designed to reduce the workload on this actor for complicated special FX by getting the emitter actor to act as a kind of controller of the vehicle its attached to for the duration of its life.

  • SFXSelfScaling Particles that automatically scale to the actor they are attached to.
  • SFXUltraLight Particles that can change the weight of an ONSVehicle for a set amount of time allowing it to be boosted over longer distances.

Related Topics[edit]


Discussion[edit]