| Home Page | Recent Changes

VitalOverdose/JumpingTeleporter

UT2004 :: Actor >> Trigger >> xKicker >> JumpingTeleporter (Package: custom)

A custom Trigger actor for UT2004

 

by VitalOverdose

Part of Vital'sPMT

This custom xkicker actor will fire ( + hard attach a nice trail effect) a pawn and then depending if the pawn went in the right direction, it will then capture and teleport (with optional sound/emitterfx) him to a random location marked out by TP point. TPPoints are actors with TP (or whatever the mapper want to set the tag to search fo to) in their tag feilds.

There is an AntiTelefrag system on it that will attemp to find a safe spawnlocation each time.

//=============================================================================
// Jumping Teleporter By vitaloverdose, Feb 2006, http://www.Vitaloverdose.com
// This is part of the 'Vitals Pro Mapping Tools' Mod 
// 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  JumpingTeleporter extends xkicker
placeable;

var() bool                              bPlaySpawnEffect;
var   bool                              bRescanTelPoints;
var   bool                              bScanning;
var   bool                              bTracking;
Var() array        < Emitter >          SpawnedElist;
var() array < Class< Emitter > >        TrailFxPool;
var() array < Class< Emitter > >        VaporiseFxPool;
var() array < Class< Emitter > >        MaterialiseFxPool;
var   Array        < Actor >            TpActors;
var() name                              TelPointTag;  // mapper can set the Tag name for tp points
var() Float                             Timerfrequency;
var() Float                             TelEntryScanRadius;
var() vector                            Tel_entry_offset;
var() sound                             VaporiseSound;
var() sound                             MaterialiseSound;
var   Int                               RescanFrequency;
var   Int                               TimeTillRescan;        

Function postbeginPlay()                             
{                                             // Run the first Scan for TelPoints  
ScanTelpoint();
Tel_entry_offset += location;

if ( RescanFrequency!= 0 )                    // checks to see if the mapper wants rescaning
   {
    settimer(0.1,true);                       // if so then set the timer to repete
   }
tpactors.Insert( 0,1 );            // creates blanks space for first TPActors vector loction;
super.postbeginplay()              // adds function related code form parent
}

Simulated function ScanTelpoint()
{
 Local Actor FoundTelPoint;

 if ( tpactors.Length != 0 )
    {
     tpactors.Remove( 0,tpactors.Length );
    }
 foreach AllActors( Class'Actor' , tpactors[0], TelPointTag )
            {
             tpactors.Insert( 0,1 );
            }
 if ( RescanFrequency != 0)
    {
     TimeTillRescan=RescanFrequency;
    }
}

Function Touch(actor other)
{
 local Emitter spawnedTrail;
 if (((other.IsA('pawn'))&&(!other.isa('Vehicle'))) && (TrailFxPool.length != 0))
    {                             
     spawnedTrail = spawn( TrailFxPool[rand(TrailFxPool.length-1)+1] ,self ,,other.location ,other.rotation );
    if (spawnedTrail!=None)
       {
        spawnedTrail.SetBase(other);
        bScanning=true;
       }
     }
 super.touch(other);
}

Function Timer()
{
 local emitter FoundEmitter;
 local emitter spawnedEmitter;

 if ( bTracking == true )
    {
    foreach radiusactors(class'emitter',foundemitter,TelEntryScanRadius,Tel_entry_offset)
         {
          if (foundemitter.Owner == self)
             {
              Tport( pawn(foundemitter.Base) );
              foundemitter.destroyed();
              if ( VaporiseFxPool.length > 0 )
                 {
                  spawnedEmitter=spawn( VaporiseFxPool[rand(VaporiseFxPool.length-1)+1], 
                                        self , ,                                        pawn(foundemitter.Base).location);
                 }
              if ( VaporiseSound != None )
                 {
                  Playsound( VaporiseSound );                        //some sound FX
                 }
              bTracking = false;                      // switches the flag for tacking off
             }
         }
    }

 if ( rescanfrequency != 0 )
    {
     TimeTillRescan -= 0.1;
     if (TimeTillRescan < 0 )
        {
         ScanTelpoint();
         TimeTillRescan = Rescanfrequency;
        }
    }
 super.timer();
}

Simulated Function  TPort(Pawn TPPawn)
{
 local   float    exraheight;
 local   Int      Pickednumber;
 local   vector   NewOffsetposition;

  If ( BPlaySpawnEffect == true )
    {
     TPPawn.PlayTelePortEffect( False,True );       // spawns fx if needed
    }
 
 Pickednumber         = FindSafeSpawnLoc(exraheight);
 NewOffsetposition    = tpactors[Pickednumber].location;
 NewOffsetposition.z += exraheight;
 TPPawn.SetLocation( NewOffsetposition );
 TPPawn.SetRotation( tpactors[Pickednumber].Rotation );
 TPPawn.OldRotYaw     = TPPawn.Rotation.Yaw;

 If ( BPlaySpawnEffect == true )
    {
     TPPawn.PlayTelePortEffect( False,True );         // spawns fx if needed
    }
 }

// this function checks for pawns being to close to the spawn point
// this way no one should get telefraged.
Function Int FindSafeSpawnLoc(out float Extraheight)  
{                                                  
 Local Pawn         Foundpawn;
 Local Int          Counter;
 Local int          PickedRNDNo;
 Local array<int>   Templist;

 Templist.Length  = tpactors.Length;

 while( Foundpawn == None )
      {
       for ( Counter = 0 ; Counter < tpactors.Length ; Counter++ )
           {
            Templist[Counter]=Counter;
           }
       for ( Counter=0 ; Counter < tpactors.Length ; Counter++ )  // pick Numbs @Random from list
           {                                               //  Numbs in sequential order
            PickedRNDNo = Rand(Templist.Length -1)+1; //RND No based on the Length of the list.
            foreach radiusActors( Class'pawn' , Foundpawn , TelEntryScanRadius , tpactors[PickedRNDNo].location + (Vect( 0,0,1) * Extraheight))
                                 {
                                  if ( Foundpawn.bCollideActors == True )
                                     {
                                      PickedRNDNo = -10;
                                     }
                                   TempList.remove( PickedRNDNo ,1 );
                                  }
           }
       Extraheight += 90;
      }
return PickedRNDNo;
}

Related Topics

 

 

Discussion

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