Legacy:VitalOverdose/SFXUltraLight: Difference between revisions

From Unreal Wiki, The Unreal Engine Documentation Site
 
(No difference)

Latest revision as of 08:11, 14 September 2011

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

by VitalOverdose

Overview

this custom emitter actor changes the weight of any ONSVehicle its attached to. + Boost and FX

class SFXUltralight Extends Emitter
placeable;

Var ()           bool                        bLockPlayersTo;
Var ()           float                       LandedLockTime;
Var ()           float                       TimerFrequency;
var ()           float                       ultralightTime;
Var (slide_in)   float                       slidein;
Var (slide_in)   Float                       IncSteps;
Var (slide_in)   Sound                       UltralightMax_Snd;
Var (slide_Out)  float                       Slidout;
Var (slide_Out)  float                       DecSteps;
Var (slide_Out)  Sound                       UltralightDec_Snd;
Var (OnCreation) bool                        bTagSuddenDeathFx;
Var (OnCreation) Sound                       OnCreation_Sound;
Var (OnCreation) Array< Class< Emitter > >   OnCreation_FxPool;
Var (suddenstop) sound                       SudenDeath_Sound;
var (suddenstop) Array< Class< Emitter > >   SudenDeath_FxPool;
Var Bool                                     bScanningTargetVec;
Var Array< float >                           TimeKeeper;
Var float                                    Incamount;
Var float                                    DecAmount;

Function PostBeginPlay()
{
if (( base == none )&&(!Owner.IsA('OnsVehicle')))
    {
     Destroyed();
     Return;
    }

SetBase( Owner );

If ((!OnsVehicle(Owner).Driver.IsA('xBot')) && ( bLockPlayersTo == false ))
    Return;

 TimeKeeper.Length = 4;
 TimeKeeper[0]     = slidein;
 TimeKeeper[1]     = ultralightTime;
 TimeKeeper[2]     = slidout;
 TimeKeeper[3]     = OnsVehicle(Owner).KGetActorGravScale();
 TogglelBotock();
 SetTimer(TimerFrequency,True);
}

Function Timer()
{
 if (vehicle(base).Driver == none)
    SuddenDeath()

 If (TimeKeeper[0] > 0 )
    {
     TimeKeeper[0]-=TimerFrequency;
     if (TimeKeeper[0]<0.1)
        SetTimer( TimeKeeper[1],False );
     Return;
   }

 if ( TimeKeeper[1] > 0 )
    {
     TimeKeeper[1] = 0;
     SetTimer(TimerFrequency,True);
     Return;
    }

 if ( TimeKeeper[2] > 0 )
    {
     TimeKeeper[2] -= TimerFrequency;
     if (TimeKeeper[2] < 0.1)
        Disable('Timer');
    }
}

function SuddenDeath()
{
 SpawnRND(SudenDeath_FxPool,bTagSuddenDeathFx);
 Disable('Timer');
 TogglelBotock();
}

Function SpawnRND(Array< Class< Emitter > > AvailableFx,Bool bTagFx)
{
 Local int              RNDPickedNumb;
 local Class< Emitter > RNDPickedEmitter;
 local Emitter          SpawnedEmitter;

 if ( AvailableFx.Length!=0 )
    {
    RNDPickedNumb  = Rand( AvailableFx.Length );
    RNDPickedEmitter = AvailableFx[RNDPickedNumb];
    SpawnedEmitter   = Spawn( RNDPickedEmitter , self ,, Owner.Location , Owner.Rotation );

    if ( ( SpawnedEmitter == none ) && ( bTagFx == True) )
       SpawnedEmitter.SetBase( Owner );
    }
}

Function TogglelBotock()
{
If ( OnsVehicle(Owner).bDriverCannotLeaveVehicle == False )
   {
    OnsVehicle(Owner).bDriverCannotLeaveVehicle = True;
    Return;
   }
 OnsVehicle(Owner).bDriverCannotLeaveVehicle = False;
}

Function Bool checkGrounded()
{
 Local Int counter;
 for ( counter=0 ; counter < OnsVehicle(Owner).wheels.Length ; counter++ )
     If ( OnsVehicle(Owner).Wheels[counter].bWheelOnGround == False )
         return False;
 Return True;
}

Related Topcs

More custom emitter scipts

Discussion