| Home Page | Recent Changes | Preferences

Scripting Movers

When the Epic movers aren't enough, it's relatively easy to script your own. These can be embedded in a map's MyLevel package.

Basic steps:

  1. Subclass a mover class (see Create A Subclass for more on this)
  2. Write the script
  3. Compile
  4. Make the red builder brush into a mover template
  5. Right-click the Add Mover button in the toolbox. The name of the new mover class appears here (not sure if subclasses of subclasses appear here though)

Example

Tarquin writes:

StandTriggerMover adds a new state. Expanding from a state wasn't really necessary, since I ended up having to copy the Attach() function across as well, since StandOpenTimed's Attach() function explicitly sends it to that state to open. (See State for more on states...)

This mover is activated both by being stood on by a player and a trigger. I've tested it and it works fine. Feel free to use it, though please credit the Wiki if you do. If you make any alterations, comment & document them here.

Turns out this script is largely pointless, and you can use BumpEvent or something to get the mover to trigger itself when stood on... sigh...

PS. The best way to credit the Wiki, besides a mention in a map's helpfile, is to add to it... :-)

//=============================================================================
// StandTriggerMover.
// This mover responds to both triggering and being stood on.
//=============================================================================
class StandTriggerMover extends Mover;

state() TriggerStandOpenTimed extends StandOpenTimed
{
 function Trigger( actor Other, pawn EventInstigator )
 {
  SavedTrigger = Other;
  Instigator = EventInstigator;
  if ( SavedTrigger != None )
   SavedTrigger.BeginEvent();

  GotoState( 'TriggerStandOpenTimed', 'Open' );
 }

 function BeginState()
 {
  bOpening = false;
 }

 function Attach( actor Other )
 {
  local pawn  P;

  P = Pawn(Other);
  if ( (BumpType != BT_AnyBump) && (P == None) )
   return;
  if ( (BumpType == BT_PlayerBump) && !P.bIsPlayer )
   return;
  if ( (BumpType == BT_PawnBump) && (Other.Mass < 10) )
   return;
  SavedTrigger = None;
  GotoState( 'TriggerStandOpenTimed', 'Open' );
 }

Open:
 Disable( 'Attach' );
 Disable( 'Trigger' );
 if ( DelayTime > 0 )
 {
  bDelaying = true;
  Sleep(DelayTime);
 }
 DoOpen();
 FinishInterpolation();
 FinishedOpening();
 Sleep( StayOpenTime );
 if( bTriggerOnceOnly )
  GotoState('');
Close:
 DoClose();
 FinishInterpolation();
 FinishedClosing();
 Enable( 'Trigger' );
 Enable( 'Attach' );

}

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In