Gah - a solution with more questions. – EntropicLqd

Difference between revisions of "UE2:VariableTimedMover"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
m (fixed to retain category (be careful while moving these scripts around, please))
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:
  
 
==Properties==
 
==Properties==
===Visible===
+
===Main===
 
; bool bActAsClientMover : This mover will be disabled on Servers, just as [[Legacy:ClientMover|ClientMover]].
 
; bool bActAsClientMover : This mover will be disabled on Servers, just as [[Legacy:ClientMover|ClientMover]].
 
; array<float> KeyMoveTime : The time (''<u>multiplier</u> of <tt>MoveTime</tt>'') it takes to go from this key number to the next. ('''Tip:''' Keep <tt>MoveTime</tt> at 1.0 to allow the <tt>KeyMoveTime</tt> values to represent seconds.)
 
; array<float> KeyMoveTime : The time (''<u>multiplier</u> of <tt>MoveTime</tt>'') it takes to go from this key number to the next. ('''Tip:''' Keep <tt>MoveTime</tt> at 1.0 to allow the <tt>KeyMoveTime</tt> values to represent seconds.)
Line 105: Line 105:
  
 
==Related Topics==
 
==Related Topics==
* [[Open_Source|Open Source]]
 
 
* [[Legacy:Mover Topics|Mover Topics]]
 
* [[Legacy:Mover Topics|Mover Topics]]
 
* [[Legacy:Mover|Mover]]
 
* [[Legacy:Mover|Mover]]
Line 111: Line 110:
 
* [[Legacy:Scripting Movers|Scripting Movers]]
 
* [[Legacy:Scripting Movers|Scripting Movers]]
 
* [[Legacy:Third-Party Components|Third-Party Components]]
 
* [[Legacy:Third-Party Components|Third-Party Components]]
 +
 +
[[Category:Custom_UE2-specific_classes|{{PAGENAME}}]]

Latest revision as of 08:35, 10 May 2008

About[edit]

This class is a special mover that allows the level designer to specify different MoveTimes (time it takes for the mover to touch a key) for each key the mover has set. This version is for use with any number of Keys and in all Mover InitialStates. Mover -> MoveTime becomes a multiplier for the VariableTimedMover -> KeyMoveTime array, so keep MoveTime at 1.0 to allow the KeyMoveTime values to represent seconds.

Properties[edit]

Main[edit]

bool bActAsClientMover 
This mover will be disabled on Servers, just as ClientMover.
array<float> KeyMoveTime 
The time (multiplier of MoveTime) it takes to go from this key number to the next. (Tip: Keep MoveTime at 1.0 to allow the KeyMoveTime values to represent seconds.)

Hidden[edit]

array<float> KeyMoveSpeed 
The actual time in seconds it takes to go from this key number to the next.

Source Code[edit]

//=============================================================================
// VariableTimedMover
// Allows custom MoveTimes per key (modified from a version by Fataloverdose)
// by SuperApe -- Sept 2005
//=============================================================================
class VariableTimedMover extends Mover;
 
var()		bool				bActAsClientMover;
var()		array<float>		KeyMoveTime;
var			array<float>		KeyMoveSpeed;
 
function PostBeginPlay()
{
	local	int		n;
 
	for ( n = 0; n < KeyMoveTime.length; n++ )
		KeyMoveSpeed[n] = KeyMoveTime[n] * MoveTime;
 
	Super.PostBeginPlay();
 
	MoveTime = KeyMoveSpeed[ KeyNum ];
 
	if ( bActAsClientMover && Level.NetMode == NM_DedicatedServer )
	{
		SetTimer( 0, false );
		SetPhysics( PHYS_None );
		GotoState('ServerIdle');
	}
}
 
simulated event KeyFrameReached()
{
	MoveTime = KeyMoveSpeed[ KeyNum ];
	Super.KeyFrameReached();
}
 
function DoOpen()
{
	MoveTime = KeyMoveSpeed[ KeyNum ];
	Super.DoOpen();
}
 
function DoClose()
{                                                   
	MoveTime = KeyMoveSpeed[ KeyNum ];
	Super.DoClose();
}
 
state ServerIdle
{
	// Do nothing on the Server
}
 
state() LoopMove
{
	event KeyFrameReached()
	{
		MoveTime = KeyMoveSpeed[ KeyNum ];
		Super.KeyFrameReached();
	}
}
 
state() ConstantLoop
{
	event KeyFrameReached()
	{
		MoveTime = KeyMoveSpeed[ KeyNum ];
		Super.KeyFrameReached();
	}
}
 
state() LeadInOutLooper
{
	event KeyFrameReached()
	{
		MoveTime = KeyMoveSpeed[ KeyNum ];
		Super.KeyFrameReached();
	}
}
 
state LeadInOutLooping
{
	event KeyFrameReached()
	{
		MoveTime = KeyMoveSpeed[ KeyNum ];
		Super.KeyFrameReached();
	}
}

Related Topics[edit]