The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall

Legacy:Making Lifts

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

(This tutorial was written using UnrealEd 3. Prior versions may follow a slightly different path than what is presented here.)

Creating a lift is a fairly simple process, once you learn how to create movers. Let's take a look at this process in detail:

Selecting the Lift[edit]

We first must choose a static mesh that will act as our lift. You can either create a static mesh or select an existing one. For the purposes of this short tutorial, select a static mesh that already exists. A good candidate is in the HumanoidHardware static mesh package, under the Miscellaneous category: MGrate04HA

Adding the Lift[edit]

Once you have this static mesh selected in the static mesh browser, click the Add Mover Brush button in the UnrealEd toolbox (this button has a picture of a blue box with several arrows coming out of it). The static mesh you selected should appear in your map and should show up as a purple color (pink if it is selected).

Placing the Lift[edit]

Move the lift to the location where you want it to start from. We now must introduce the concept of keyframes. A mover can have a total of 8 keyframes. Think of these as navigation points which the mover will travel along. Our lift will begin at frame 0, travel to frame 1, then frame 2, etc. Normally, lifts only have 2 keyframes, so we will only use two for this example.

Right click on the static mesh, select the Mover submenu and select the Key 1 menu item. We have just told UnrealEd to note where keyframe 1 is located. Now move your lift to its destination location. This new position is where keyframe 1 is located. If you right click the static mesh again, select the Mover submenu and select the Key 0 menu item, you will note that the lift returns to its starting position! Once you have returned the lift to its starting position, it is time to begin editing the lift properties.

Setting Lift Properties[edit]

Again, right click the static mesh we are using for our lift, and select the Mover Properties menu item. The properties window will appear. First, expand the Object category. We should change the InitialState variable from a value of BumpOpenTimed to StandOpenTimed. This will prevent the lift from rising up the instant the player touches it (which could cause the lift to leave without the player).

Next, expand the Mover category. There are many different settings available here, but we are primarily focused on just a few. First is the MoverEncroachType variable. The two most interesting values here are ME_ReturnWhenEncroach and ME_CrushWhenEncroach. The first value will cause the lift to return to the previous keyframe if it collides with an actor (e.g., a player is underneath the lift as it comes down). The latter value will cause the player to be crushed if they are caught underneath the lift (or they hit their head on something on the way up). Let us leave it at ME_ReturnWhenEncroach for now.

Two other important settings are MoveTime and StayOpenTime. These values are how long (in seconds) the lift takes to move from the first keyframe to the last one, and how long the lift waits before returning in the opposite direction, respectively.

If you have more than two keyframes, you must change the NumKeys variable from 2 (the default) to however many keyframes your lift has. So, if my lift has 5 keyframes, I give this variable a value of 5.

For lifts that use triggers see Legacy:Making Lifts/Triggered Lifts

Setting the Unique Tag[edit]

This is an incredibly important step, so make sure you do this. Expand the Events category and note the Tag variable. By default, movers have a Tag value set to Mover. You need to change this to something unique. I commonly use the same value as the Name variable in the Object category. Doing this will prevent a few annoying bugs (such as the ME_ReturnWhenEncroach failing to work when more than one lift is in your level).

Adding Sound[edit]

Finally, let us add some sounds to our lift. Expand the MoverSounds category. Listed here are several variables:

  • ClosedSound: This sound is played when the lift arrives at its last KeyFrame.
  • ClosingSound: This sound is played when the lift starts moving towards its last KeyFrame.
  • LoopSound: If the lift's InitialState is set to ConstantLoop, then it will play this sound when it reaches its first and last KeyFrame.
  • OpenedSound: This sound is played when the lift arrives at its first KeyFrame.
  • OpeningSound: This sound is played when the lift starts its first KeyFrame.

For our simple example, we only care about ClosingSound and OpeningSound. Select an appropriate sound for both. I usually use the door1 sound, which can be found in the IndoorAmbience sound package.

Conclusion[edit]

Save your map, build all and test it out! Your lift should move from one position to the other, include sound and do the right thing if it hits you on the head! That wasn't so hard, was it?

Related Topics[edit]