UE1:RJumpPad

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 10:29, 19 April 2008 by Raven (talk | contribs) (New page: __TOC__ ==About== This is class for classic Unreal Tournament '99. Based on JumTarget and JumpZModifier it calculates real jump velocity. In opposition to Kicker this class igoners player...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

About

This is class for classic Unreal Tournament '99. Based on JumTarget and JumpZModifier it calculates real jump velocity. In opposition to Kicker this class igoners player velocity. It was inspired by Jumppad from UT 2004;

Properties

Visible

bool bDebugJump
allows to change JumpZModifier in game (for debug purpose only)
Actor JumpTarget
jump target (eg. Actor'MyLevel.LiftExit0'
float JumpZModifier
jump z modifier is used for tweaking Jump, if needed
sound JumpSound
jump sound
name JumpClasses
clase able to use RJumpPad

Hidden

vector RealJumoVelocity
The actual, calculated, jump velocity.

Source Code

<uscript> //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Changed kicker (UT'99) and JumpPad (UT2k4) // actor is for UT'99 and other Unreal Engine 1 games. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Raven class RJumpPad extends Triggers;

var(Advanced) bool bDebugJump; // allows to change JumpZModifier in game (for debug purpose only) var() Actor JumpTarget; // jump target (eg. Actor'MyLevel.LiftExit0' var() float JumpZModifier; // jump z modifier is used for tweaking Jump, if needed var() sound JumpSound; // jump sound var() name JumpClasses; // clase able to use RJumpPad var() bool bRandomize; // should velocity be randomized var vector RealJumoVelocity;

replication { reliable if( Role == ROLE_Authority ) CalculateJumpVelocity; }

simulated function PostBeginPlay() { if(JumpTarget == none) Destroy(); RealJumoVelocity = CalculateJumpVelocity(); }

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

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

function vector CalculateJumpVelocity() { local vector XYDir, JumpVelocity; local float ZDiff, Time, GravityZ;

GravityZ = Region.Zone.ZoneGravity.Z;

XYDir = JumpTarget.Location - Location; ZDiff = XYDir.Z; Time = 2.5f + JumpZModifier * Sqrt(Abs(ZDiff/GravityZ)); JumpVelocity = XYDir/Time; JumpVelocity = XYDir; JumpVelocity.Z = ZDiff + JumpZModifier;

return JumpVelocity; }

simulated function PostTouch( actor Other ) { local bool bWasFalling; local vector Push; local float PMag;

if(bDebugJump) { RealJumoVelocity = CalculateJumpVelocity(); BroadCastMessage("X="@RealJumoVelocity.X@"Y="@RealJumoVelocity.Y@"Z="@RealJumoVelocity.Z); }

bWasFalling = ( Other.Physics == PHYS_Falling ); if ( bRandomize ) { PMag = VSize(RealJumoVelocity); Push = PMag * Normal(RealJumoVelocity + 0.5 * PMag * VRand()); } else Push = RealJumoVelocity; if ( Other.IsA('Bot') ) { if ( bWasFalling ) Bot(Other).bJumpOffPawn = true; Bot(Other).SetFall(); } if(JumpSound != none) PlaySound(JumpSound); Other.SetPhysics(PHYS_Falling); Other.Velocity = Push; }

defaultproperties { JumpClasses=Pawn } </uscript>

Related Topics