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:
- Subclass the mover class (see Create A Subclass for more on this)
- Write the script
- Compile
- Make the red builder brush into a mover template
- Right-click the Add Mover button in the toolbox. The name of the new mover class appears here, subclasses of subclasses will not appear (e.g. a subclass of LoopMover, which is itself a subclass of Mover).
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?
[CK]Davros Minor mods to the Basic Steps, just to say that it must be a sublass of "THE mover class" not "a mover class" and that subclasses are not shown in the right-click menu. I'm not going to make a mess of this article but just to say that I've used this to make a GradualLoopMover which both moves in a loop (i.e. goes from KeyNum 'n' to KeyNum 0 directly without going back through all the previous Keys.) and also offers varying move speeds. So if this is "largely pointless", well, there's another use for it.