Creating elevators using props

Three Million

L4: Comfortable Member
Jul 2, 2015
197
75
There is an elevator that I am building on my map. I know for the button I have to use a func_button, func_door for the metal door and a func_tractrain (perhaps?) for the actual elevator. Here's the setup of what I have so far

Zp52Ub5.png


The trouble I am having is how to script it so the func_button calls the elevator, and when the elevator reaches the floor the func_door gets triggered and the doors open. It is only a two story elevator so I would need to be able to call it from the bottom floor, the top floor, and have the user able to push the button inside the elevator to take it to the correct floor.

I have done some research, using this and this as a guide but I am still a bit lost.
 

Pawlakov

Deliberately incoherent
aa
Jun 1, 2013
189
41
I don't think you should use buttons in tf2. You can try using trigger_multiple or other triggers.
By the way: Why do you need an elevator in tf2 map? You can use stairs instead.
 

Vel0city

func_fish
aa
Dec 6, 2014
1,947
1,589
Elevators are fine in single player Source games, but for TF2 (and CS:GO for that matter) you should avoid moving platforms that go up and down at all cost. Source's hitreg gets really wonky on platforms. It's not a huge problems on payloads and other sideways moving objects, but as soon as they go up and down, well, good luck hitting 20% of your shots. As Pawlakov said, use stairs.
 

SC PL

local shitposter
aa
Jun 25, 2015
378
407
Well, you can make elevator using path_track and func_tracktrain. But elevator shouldn't be on offical TF2 gamemodes maps. It will be good on other gamemodes like achievement. In func_button in outputs use "When Damaged" instead "When Pressed", because there's no press button key in TF2.
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
Well, you can make elevator using path_track and func_tracktrain. But elevator shouldn't be on offical TF2 gamemodes maps. It will be good on other gamemodes like achievement. In func_button in outputs use "When Damaged" instead "When Pressed", because there's no press button key in TF2

Do your research first please. There is a press button, it's just not bound by default.
ALWAYS use "OnPressed" Output, it's so much better than "OnDamaged".
You can give your func_button the "Damage activates" and the "Use activates" flags so you can trigger the "OnPressed" Output with both damage and the use key.
 

Muddy

Muddy
aa
Sep 5, 2014
2,574
4,592
Do your research first please. There is a press button, it's just not bound by default.
ALWAYS use "OnPressed" Output, it's so much better than "OnDamaged".
Except not everyone has +use bound to a key, nor will most people even think to use +use because it's never used in TF2 (unless you play on Mario Kart maps).

You'd be better off just using the damage inputs instead, since when most people see a button in TF2 their first instinct is to hit it with their melee weapon.
 

Three Million

L4: Comfortable Member
Jul 2, 2015
197
75
Well, you can make elevator using path_track and func_tracktrain. But elevator shouldn't be on offical TF2 gamemodes maps. It will be good on other gamemodes like achievement. In func_button in outputs use "When Damaged" instead "When Pressed", because there's no press button key in TF2.
I should have mentioned that this is a trade/idle map that really just moves the player to a different platform. The map already has tons of stairs and ramps, just thought an elevator would be a good change

Except not everyone has +use bound to a key, nor will most people even think to use +use because it's never used in TF2 (unless you play on Mario Kart maps).

You'd be better off just using the damage inputs instead, since when most people see a button in TF2 their first instinct is to hit it with their melee weapon.
Thats what my reaction is, then if it doesnt work I use the key I have +use binded too. It is kind of a hit and miss on maps, some use the +use key and others you hit to trigger events.

Speaking of, is there still a possibility of getting some help with this? Or should I abandon all hope now?
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
Except not everyone has +use bound to a key, nor will most people even think to use +use because it's never used in TF2 (unless you play on Mario Kart maps).

You'd be better off just using the damage inputs instead, since when most people see a button in TF2 their first instinct is to hit it with their melee weapon.
I said that it's not bound by default in my OP.
And the "OnPressed" output will fire if you shoot buttons too, as long as the "damage activates" flag is ticked.
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
Izotope has given the best information so far. I am a Deathrun mapper and use OnPressed for all my button outputs, as they both activate by damage (if you enable the spawnflag) or +use if your server has it enabled.

Since you're only going up and down between two floors, it's best to use a func_door for the vertical motion of the elevator. This is because they are very simple entities to set up, and they stop precisely. func_tracktrain and path_tracks are more complicated and although they have some benefits like speed modulation and are good for multiple floors, their stopping positions are inaccurate. You will frequently find a stopped tracktrain around 16 units over or under its terminal path_track. They also bounce backwards when halting at speed.

You need to parent all the entities that make up your lift to your new vertical func_door. Put a tick in its 'Non-solid to players' spawnflag. That ensures that players will not stop the elevator from moving if they are standing inside/on top of a parented object and touch each other. It goes without saying that you should enable Force Closed and specify a Blocking Damage for those times where players try to break things. If your vertical func_door is inside the elevator where players can stand, tick the 'Passable' spawnflag so players will not collide with it. Set its move direction up or down. This is the direction it will move when it 'opens'. The position that it sits at in Hammer is where it will spawn in-game, and it will be in the 'closed' position. Set the 'return time' to -1 so the door never automatically closes itself after opening.

In order to send your elevator up or down, you'll need to send it the 'open' or 'close' input from whichever button the user presses - inside or out. The reverse is true for the opposite direction. You should send your buttons the 'Lock' input so that they cannot be pressed again until you send them the 'Unlock' input. This stops people messing with the buttons. I'll leave it up to you to experiment with the buttons and logic, so you can learn for yourself. Remember you can use the ent_fire command in the TF2 console to send inputs to your entities, which is very useful for testing.

Here's a tip: func_door can send outputs when it is fully open, fully closed, or when it begins to open or close. When your vertical func_door parent reaches its destination (fully closed or fully open), you can have it send an output to its doors to open them up in order to let the occupant out.

Bear in mind that players will try to block the elevator by standing underneath or above it when it's arriving. Blocking damage should take care of this, but you can kill them using trigger_hurt parented to the elevator. You can also use logic to kill anyone who blocks the vertical func_door. OnBlockedClosing/Opening > !activator > SetHealth 0.

If you need any more help we are happy to provide it. I'm interested to see your work if it exists on any servers.
 

Three Million

L4: Comfortable Member
Jul 2, 2015
197
75
Thank you so much for helping me with this, your write up worMatty was really helpful. When it is done, hopefully soon, I will post it on here for you guys to take a look.

Edit: Currently experimenting with the func_doors, will post if I have any more questions.
 
Last edited:

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
Cool, glad to be some help. Great, I look forward to seeing your work. Trade maps are inventive.
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
You have parented your big func_door to your prop_dynamic. The parent is the thing that moves, and its children will move with it. Your big func_door is your movement parent so it shouldn't be parented to anything else. Your prop_dynamic elevator and the other stuff like doors will be the children and so must be configured to use your vertical func_door as a parent, the name of which is elevator_path in your example.

You have set your vertical func_door to have the flag Touch Opens but haven't given it Passable. This means players will be able to touch it, which will make it start, and it will block them from getting in the elevator.

You have set your button outputs to use OnUser1 rather than OnPressed. The User logic chains are special-use global things that work across the whole map and don't need to be specified from entity to entity using targetnames (entity names). Typically used when there are a lot of entities to control somehow, it saves work for the mapper because they don't need to bother giving lots of stuff a targetname. In this case your logic is localised to these elevator entities and is very simple. The OnUser outputs won't fire until you fire the FireUser outputs somehow, from some other logic entity.

Haven't set the move direction of your func_door to Up.

Your big func_door is the length of the distance between the bottom of your shaft to the top. When a func-door moves, it moves the length of itself. So if it's 128 units tall and it moves up, it will move 128 units. In your map, your elevator would go through the ceiling of the second floor. I have cut it down so the top of it is level with the second floor, so the elevator will arrive at the correct level.

The outside buttons work more or less okay. If you take this VMF you should be able to carry on setting it up to your liking. Also note I made a func_brush skeleton for the elevator, because it didn't have a collision mesh.
 

Three Million

L4: Comfortable Member
Jul 2, 2015
197
75
Thank you very much for helping! I am working on the button inside the elevator, it should be able to take the person to the opposite floor they are one. Such as if you are on the first floor and push the inside button it should take you to the second floor and vice versa. I am using a logic_compare (or perhaps a logic_auto?) to handle the logic. Basically the inside elevator buttons needs to be some if else statement.
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
Hi, there.

What do you need help with?
 

Three Million

L4: Comfortable Member
Jul 2, 2015
197
75
Thank you very much for helping! I am working on the button inside the elevator, it should be able to take the person to the opposite floor they are one. Such as if you are on the first floor and push the inside button it should take you to the second floor and vice versa. I am using a logic_compare (or perhaps a logic_auto?) to handle the logic. Basically the inside elevator buttons needs to be some if else statement.

TL;DR: Make the buttons on the inside of the elevator work
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
You don't need to bother with If statements.

Name your lift's internal button elevator_button_inside and enable its 'Toggle' spawnflag. This lets you define two outputs for the button, each firing when the button is pressed in or pressed out, turning the switch in to a latching double-throw switch. give it these outputs:

goZCurj.png


Now visit the two buttons on the outside and delete their existing outputs, replacing them with this:

r60NePR.png


... and 'PressIn' for the upstairs button. This makes it so that all of the logic that controls the position of the elevator (Open or Closed) is handled by that internal switch. Since you told that switch to lock itself for five seconds, it won't accept any input from any button until it's reached a floor and stood there for a second. You'll probably want to increase the locking duration. That means you can get rid of any logic locking the outside buttons, as you won't need it, since the internal button ignores anything while the elevator is in motion.