| Home Page | Recent Changes

SabbathCat/Trampoline

(Package: Custom - WIP)

This is a UT actor.

//=============================================================================
// Trampoline
// Bots hitting this will bounce 3* the Z falling speed upwards.
//=============================================================================
class Trampoline extends Trigger;

var vector KickVelocity;
var() bool bShowMe;
var float KickZMultiply;
var() name KickedClasses;
var() sound KickMeSound;
var() bool bMakeNoise;
var() bool bRestrictVelocity;
var() float MaxVelocity;
var() float ExtraKick;


function PostBeginPlay()
  {
    Super.PostBeginPlay();
    if (!bShowMe )
    {
          DrawType = DT_None;
          bHidden = True;
    }

  }


simulated function Touch( actor Other )
{
    local Actor A;

    if ( !Other.IsA(KickedClasses) )
        return;
    PendingTouch = Other.PendingTouch;
    Other.PendingTouch = self;
    if( Event != '' )
        foreach AllActors( class 'Actor', A, Event )
            A.Trigger( Other, Other.Instigator );
}

simulated function PostTouch( actor Other )
{
    local bool bWasFalling;
    local vector Push;
    local float PitchMeBounce;
    local actor a;
    local float GravityThird;
        local vector MyOldGravity;

    bWasFalling = ( Other.Physics == PHYS_Falling );
            if ( Other.IsA('Bot') )
    {
        if ( bWasFalling )
                {
            Bot(Other).bJumpOffPawn = True;
                        Bot(Other).bTacticalDir = True;
                        Bot(Other).bJumpy = True;
                    Bot(Other).SetFall();
                }
    }
    Other.SetPhysics(PHYS_Falling);


        GravityThird = Abs(Region.Zone.ZoneGravity.Z/3);


    If ( bRestrictVelocity)
        {
        Log("              ");
        Log("*********>>     EXTRA KICK   = TRUE ******<<");
        Log("              ");
        Push.Z = ((Abs(Other.Velocity.Z))*2)+ExtraKick;
        
        }
        Else If ( !bRestrictVelocity)
    {
        Log("              ");
        Log("*********>>     EXTRA KICK   = FALSE ******<<");
        Log("              ");
        Push.Z = ((Abs(Other.Velocity.Z))*2.25)+10;
    }
        If ( Push.Z <= 0 )
        {
        Push.Z = -Push.Z;
        Log("          Push.Z = -Push.Z");
        }
        Else if ( Push.Z <= (GravityThird+ExtraKick) )
        {
        Push.Z = (GravityThird+ExtraKick)+128;
        Log("          Push.Z = (GravityThird+ExtraKick)+128");
        }
    MyOldGravity=Other.Velocity;
    MyOldGravity+= Push;
        If ( MyOldGravity.Z <0 )
        {
        MyOldGravity.Z = -MyOldGravity.Z;
        }
    If ( bRestrictVelocity && MyOldGravity.Z > MaxVelocity )
    {
    MyOldGravity.Z=MaxVelocity;
        Log("              ");
        Log("MaxVelocity  : "$MaxVelocity);
        Log("MyOldGravity : "$MyOldGravity);
        Log("              ");
    }
        Other.Velocity = MyOldGravity;
        Log(" MyOldGravity "$MyOldGravity$"      <<  ");

    PlaySound (KickMeSound, , Float(SoundVolume)/128, , Float(SoundRadius)*25);
    MakeNoise(238);
}


defaultproperties

{
     KickedClasses=Pawn
     RemoteRole=ROLE_SimulatedProxy
     bDirectional=True
     KickMeSound=Sound'AmbModern.OneShot.cscanE2'
     bMakeNoise=True
     bHidden=False
     DrawScale=1.500000
  DrawType=DT_Mesh  
  Mesh=LodMesh'Botpack.FastSprocket'
  bCollideWhenPlacing=True
  CollisionRadius=64.00000
  CollisionHeight=16.00000
  MultiSkins(0)=Texture'Botpack.Skins.Jlightcone11'
  MultiSkins(1)=Texture'Botpack.Skins.Jlightcone11'
  MultiSkins(2)=Texture'Botpack.Skins.Jlightcone11'
  bShowMe=True
  bEdShouldSnap=True
  bStatic=False
  bNoDelete=False
  bRestrictVelocity=False
  MaxVelocity=2500
  ExtraKick=256
}

The Trampoline will increase the players Z velocity each time it is hit, up until the point where the bot/player achives the speed determined by the MaxVelocity default property.

Using the Trampoline

Place somewhere with plenty of headroom, perhaps at the botom of a well, with a useful pick-up. Who knows? :)

Properties

These are the properties and their default values:

KickMeSound = Sound
Is the Sound made when the Trampoline is triggered.

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