Legacy:Scripting Movers - Unreal Wiki

# Legacy:Scripting Movers

### From Unreal Wiki, The Unreal Engine Documentation Site

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' );

    }

## Related Topics

- VariableTimedMover
- UnrealScript
- UnrealScript Lessons
- Making Mods
- Custom Mover

## Discussion

Dr.AwkwArD: Was this for UT99?

Tarquin: yes. Though in principle it should work with any version, with maybe tweaks.

Vitaloverdose About the Function attach...i cant see any attaching going on, is there any chance you could provide some info as to what its doing? Maybe some line comments?

Categories: Legacy Tutorial | Legacy Custom Class (UT) | Legacy Custom Class (UT2004)

##### Views

- Legacy
- Discussion
- Current revision

##### Search