Worst-case scenario: the UEd Goblin wipes the map and burns down your house.

Legacy:VitalOverdose/SFXTriggering

From Unreal Wiki, The Unreal Engine Documentation Site
< Legacy:VitalOverdose
Revision as of 08:05, 14 September 2011 by Vitaloverdose (Talk | contribs) (More custom emitter scipts)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
UT2004 :: Actor >> Emitter >> SFXTriggering (Package: custom)

by VitalOverdose

Overview[edit]

This custom emitter script can tack a set amount of particles (20) from an emitter and trigger an event on collision with pawns. The event to trigger can be set by the mapper in unrealed.

PostBeginPlay()[edit]

(generic:called just after it enters gameplay)

here the max particle property is check to see if it is under 21 particles and then the timer function is activated using 'timer frequncy' to set the scan rate.

Simulated function PostBeginPlay()
{
 Super.PostBeginPlay();
  If ( Emitters[ActiveEmitterNumb].MaxParticles > 20)           //active particles capped to max20
     Destroyed();
 
  If (TimerFrequency<0.1)
     TimerFrequency = 0.1;
 
 SetTimer( TimerFrequency , True );
}

function Timer()[edit]

Each time timer is called the live particles from this emitter will be located and then have their location scanned for a valid collision. We are able to list all visible colliding actors by using an iterator.

(generic:called to order)

Simulated Function Timer()
{
 Local Actor           FoundActor;
 Local Int             Counter;
 for ( Counter=0 ; Counter < Emitters[0].Particles.Length ; Counter++ )
      foreach visiblecollidingActors(Class'Actor', FoundActor , ScanSize , Emitters[ActiveEmitterNumb].Particles[Counter].Location )
               TriggerEvent( CollidedWith.Tag , Self , Instigator );
}

Here is the complete script;-

Full Script[edit]

////////////////////////////////////////////////
//Class SFXTriggering for Unrealtournament 2004
//Single player only
//by VitalOverdose Jan 2006
//Http://vitaloverdose.zapme.to.org
///////////////////////////////////////////////
class SFXTriggering Extends Emitter
placeable;
 
Var            int                    TotalParticles;
Var ()         int                    ActiveEmitterNumb;
Var ()         int                    TimerFrequency;
Var ()         Float                  ScanSize;
 
Simulated function PostBeginPlay()
{
 Super.PostBeginPlay();
 
//active particles capped to max20 
 If ( (Emitters[ActiveEmitterNumb].MaxParticles > 20) || (TimerFrequency<0.1))           
     Destroyed();
 
// start the timer function and set it to repeat
 SetTimer( TimerFrequency , True );
}
 
Simulated Function Timer()
{
 Local Actor           FoundActor;
 Local Int             Counter;
 
//itterate through the any visible colliding actors withing 'scansize' radius of the particle location calling TriggerEvent() each time 
for ( Counter=0 ; Counter < Emitters[0].Particles.Length ; Counter++ )
      foreach visiblecollidingActors(Class'Actor', FoundActor , ScanSize , Emitters[ActiveEmitterNumb].Particles[Counter].Location )
               TriggerEvent( CollidedWith.Tag , Self , Instigator );
}
 
defaultproperties
{
bNoDelete=False
RemoteRole=ROLE_SimulatedProxy
}

Related Topcs[edit]

More custom emitter scipts[edit]

Discussion[edit]