Once I get that upgrade to 36-hour days, I will tackle that. – Mychaeel

UE1:RJumpPad

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 12:56, 28 April 2008 by Raven (Talk | contribs) (Related Topics)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

About[edit]

This is class for classic Unreal Tournament '99. Based on JumpTarget 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[edit]

Visible[edit]

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[edit]

vector RealJumoVelocity 
The actual, calculated, jump velocity.

Source Code[edit]

UE1 Triggers >> Actor >> RJumpPad (custom)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// 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
}