VERC: Elevator No. 2 Last edited 5 years ago2019-04-14 10:50:42 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.

Introduction

This tutorial describes the process of making an elevator that can move between more than two floors. It is a platform elevator, not a normal enclosed elevator. To keep things as simple as possible, I didn't make it with buttons that move with the elevator, although that could easily be incorporated as well.

There are two parts to this tutorial -
  1. The elevator construction - this is the easy part.
  2. The button "state checking" - this is the more complicated part. This is where you give your elevator "rules".
For this tutorial, the rules will be:
  • The elevator "call" button can only be activated if the elevator is on another level.
  • The elevator movement buttons can only be activated if the elevator is on the current level.
  • If the elevator is between levels, none of the buttons can be activated.
Prepare for a bit of head spinning!

Setup - Elevator Construction

The construction of the elevator is the easy part. Below is a cut-away view showing the first stage of the construction.
User posted image
The setup and configuration of a func_train and its path_corners is explained in the func_train entity description. Only the entity properties outlined below should be set.

func_train (elev1)

This is the elevator. It should be built in a location that will give it even lighting, as it will automatically move to the first stop target when the level loads, but it will retain its lighting from where it was originally built. By starting the elevator on the second level, I was able to give it even lighting without having to build it at a separate location. The above properties are the only essential ones. You might also want to modify the speed and sounds, as you see fit.

path_corner (p1, p2, and p3)

These are the path points the elevator will move to. The main difference between these and a normal set of path_corners is that these only have a Name, no "next stop target". This will be explained more below. In addition to the Name setting, each path_corner must have its Wait for retrigger flag checked. This causes the elevator to stop and wait at each level.

"Call" buttons

In the next step, we'll setup the "call" buttons. These will be used to call the elevator to your level if it isn't there. Useful, no? :) Below is the same cut-away view as above with the "call" buttons and their associated entities. (They would, of course, be set on a wall).
User posted image

func_button ("call" buttons, #1, #2, and #3)

These are the buttons that you'll press to call the elevator. They're setup is pretty straightforward. Each func_button should also have its Don't Move flag checked. This is for esthetic reasons and avoids the delay of the button pressing.

multi_manager (mm_button1, mm_button2, and mm_button3)

These multi_managers coordinate the events that occur when the "call" button is pressed. The use of multi_managers is outlined in the multi_manager entity description.

trigger_changetarget (to_l1, to_l2, and to_l3)

When activated, these set the target of the elevator to the level of the "call" button that was pressed. The use of the trigger_changetarget entity is outlined in the trigger_changetarget entity description.

Elevator Movement buttons

Now we'll add some buttons to move the elevator between the levels. Below is another picture of the same cut-away view. The buttons, multi_managers, and trigger_changetargets added in the previous step have been hidden to avoid a cluttered look.
User posted image

func_button ("move" button #1, #2, #3, and #4)

These buttons act exactly like the "call" buttons, except that they cause the elevator to move up or down a level (depending on which button is pressed) and the player is generally assumed to be on the elevator when a button is pushed. Note that, whereas everything previous to this step involved multiples of 3, this has 4 buttons because the middle level has a button for both up (#2) and down (#3). Each func_button should also have its Don't Move flag checked.

multi_manager

These multi_managers coordinate the events that occur when the "move" button is pressed. The use of multi_managers is outlined in the multi_manager entity description.

trigger_changetarget (l1_l2, l2_l3, l2_l1, and l3_l2)

When activated, these set the target of the elevator to the appropriate level depending on which "move" button was pressed. The use of the trigger_changetarget entity is outlined in the trigger_changetarget entity description.

Stretch!

Ok, that's that part. That was the easy part?! Well, not really. It's a little head spinning, no? That is the straightforward part though. You'll have something that looks similar to the picture below (again, this is a cut-away... you should have walls and stuff too. :)
User posted image
You might note that the colors of the entities are different. This is because i've turned them into VisGroups so I could easily hide them.

You can now run and test your level. The buttons should all work - if you press a "call" button, the elevator will move to the appropriate level. If you press a "move" button, the elevator will take you to the appropriate level. But wait, if you press a "move" button when the elevator is not at your level, the elevator will move as if it was. This just isn't right! :) In the next section, we'll setup the state-checking entities that will prevent this.

Setup - Button State Checking

In this section, we're going to impose a few rules on the use of the buttons.
  1. The elevator "call" button can only be activated if the elevator is on another level.
  2. The elevator movement buttons can only be activated if the elevator is on the current level.
  3. If the elevator is between levels, none of the buttons can be activated.
Below is a cut-away picture showing all of the entities that you'll be placing/modifying/using for setting up the first level's state checking.
Is your head spinning?Is your head spinning?

Keepers of the State

Ok, we'll start with the group of 7 entities that are responsible for tracking the state of the elevator and controlling what buttons are active when. Only 6 of the entities are used to keep track of the states. The sixth, the all_off multi_manager, is there for ease of use only. Activating it will turn all of the buttons off.

multi_manager (all_off)

This entity isn't entirely necessary, but it simplifies things greatly.
As mentioned above, activating this turns off all of the "call" and "move" buttons. Yes, yes, I know - none of the above entities (eg_call*_off, eg_elev*_off) have been defined yet. Patience, grasshopper.

multisource (ms_call1)

This is the multisource master for the level 1 "call" button. When it is "off", the button will be disabled. Now that you've created this multisource, select the level 1 "call" button, and in its properties, set its Master (master) property to ms_call1.

env_global (eg_call1_on)

Activating this entity will set the call1state global state to "on", enabling the ms_call1 multisource. The Set Initial State flag should also be set. Now, when the level starts, this will immediately set the state of call1state global to "on". Each time this entity is triggered afterward, it will always set the state of call1state to on.

env_global (eg_call1_off)

Activating this entity will set the call1state global state to "off", disabling the ms_call1 multisource. Do not check the Set Initial State flag for this entity. Each time this entity is triggered, it will set the state of call1state to off.

multisource (ms_elev1)

This is the multisource master for the level 1 "move" button. When it is "off", the button will be disabled. Now that you've created this multisource, select the level 1 "move" button, and in its properties, set its Master (master) property to ms_elev1.

env_global (eg_elev1_on)

Activating this entity will set the elev1state global state to "on", enabling the ms_elev1 multisource and, in turn, the level 1 "move" button. Do not check the Set Initial State flag for this entity. Each time this entity is triggered, it will set the state of elev1state to on.

env_global (eg_elev1_off)

Activating this entity will set the elev1state global state to "off", disabling the ms_elev1 multisource. The Set Initial State flag should also be set. Now, when the level starts, this will immediately set the state of elev1state to "off". Each time this entity is triggered afterward, it will always set the state of elev1state to off.

Final Thingies

Last, you've got to connect the state-checkers to the appropriate multi_managers so they're functional. In addition, the p1 path_corner must have its Fire on Pass (message) set to mm_elev_1, so this multi_manager gets activated when the elevator reaches the p1 path corner.

Whenever a "call" or "move" button is pressed, all of the buttons are disabled (satisfying rule #3). When the elevator reaches its target level, the path_corner activates its multi_manager which turns on the "move" buttons for that level (satisfying rule #2), and activates all of the "call" buttons except for the one on that level (satisfying rule #1).

Notes

Ok, each level has almost the identical setup, except for the all_off multi_manager which only needs to be created once but is referenced at each level, so I'm not going to list the other levels here. It would be a little redundant and my head would be in danger of exploding. If you want more detail, please check out the example map - the entities are set out pretty neatly and it should be easy to follow the logic of everything. The VisGroups are also setup to allow for easiest visibility of the inner-workings.

Here's what the entity setup looks like in the finished example map.
Crikey!Crikey!
There are a few things that should be mentioned.
This tutorial was written prior to the release of Spirit of Half-Life. The mod greatly simplifies the attachment and movement of entities.
This article was originally published on the Valve Editing Resource Collective (VERC).
TWHL only archives articles from defunct websites. For more information on TWHL's archiving efforts, please visit the TWHL Archiving Project page.

Comments

You must log in to post a comment. You can login or register a new account.