Thread: [Advanced] How to trigger something after using a button for a period of time.

Results 1 to 6 of 6
  1. #1
    Mapper Nih's Avatar  
    Manager
    Join Date
    Dec 2002
    Location
    Denmark
    Posts
    5,485

    [Advanced] How to trigger something after using a button for a period of time.

    Sounds boring doesn't it? However, this can in fact be used for a wide variety of things. Take the bomb defusal mission in Incoming.bsp as an example. One of the players must attempt to defuse a bomb, while the other players hold off the assassins. It could also be used in a situation where you want the players to "hack" a door before it opens. Or even use it create a form of "Capture Point" where a group of players must protect the capper from attacking enemies before an area gets secured.

    I was personally planning to use this in a map concept where I wanted the players to escape from an ancient alien structure, by having 1 player hack all the doors while the others protected him from an onslaught of demonic creatures that were accidently released by the slightly too curious scientists. As such, this tutorial will focus on how to use this for opening doors.



    Here we have the door, closed and untouched. On the right side we have the computer the player must use, and on the left side we have the progress bar showing the players how close they are to opening the door.

    Start out by creating the func_door you want opened and name it "door1"
    In my map I'm actually using 2 doors, but that doesn't really matter.

    Next, create the button/computer you want the players to operate. This shouldn't be an actual button, but simply a brush that looks like one.
    The real button comes next. The button we want is a momentary_rot_button. Since you rarely want a button that rotates as you use it (unless you're using a valve), we're going to apply the null texture to the real button, and make it look like the player is using the fake button.
    The momentary_rot_button should be small enough to prevent the players from "feeling" it, but big enough so the players actually use it when they try to use the fake button.
    Set "dooropener1" as the target, and set "Distance (deg)" to 360.

    The next thing we're going to do is to add the red progress bar to the left of the door. It isn't necessary to do this, but the players will appreciate having some sort of indicator of their progress.
    Create 4-5 brushes to cover the progress bar. Set them as "func_wall", give them rendermode additive or texture, and set fx to something reasonable. 96 should do it.
    Next, create a momentary_door that fits into the cover. Place it under the floor so it can't be seen before used, and adjust position and lip size so it eventually reaches the top of the cover. Give it the name "dooropener1". You might also want to set "delay before close" to -1, but I'm not sure if that's necessary.

    Now it gets a little strange. The next thing you have to do is to create a separate room that players will never be able to see. Copy dooropener1 to this room. Place a func_pushable on top of the bar. The pushable should not be smaller than 7x7x7 units, or it might not be movable.
    Now, place a trigger_multiple right on top of dooropener1's final position. Set "door1" as the target, and check the flags "Pushables" and "No Clients."

    So basically, what's going to happen is that the players will be using the fake computer, and once the fake progress bar reaches the top, the pushable reaches the trigger_multiple and the door opens. There is no easier way to accomplish this.

    The end result:


  2. #2
    Registered User
    Join Date
    Jun 2006
    Posts
    14

    Re: [Advanced] How to trigger something after using a button for a period of time.

    Neat tutorial. Could you use the 'fire on close' trigger from the progress bar to open the door? Possibly through a trigger_relay which removes itself to make sure the door won't close again.

    I might well use this concept in a map I'm working on. This has also served to explain to me how the fancy wall wheels work (I didn't know about the momentary_ entities). So cheers for that!

  3. #3
    Mapper Nih's Avatar  
    Manager
    Join Date
    Dec 2002
    Location
    Denmark
    Posts
    5,485

    Re: [Advanced] How to trigger something after using a button for a period of time.

    If that was possible I've certainly wasted a lot of my time setting up this system The problem is that momentary_door doesn't register when it has been fully opened, so you have to create this work-around.

  4. #4
    Registered User
    Join Date
    Jun 2006
    Posts
    14

    Re: [Advanced] How to trigger something after using a button for a period of time.

    Right, I assumed there was a good reason

  5. #5
    Registered User vluzacn's Avatar
    Join Date
    May 2010
    Location
    China
    Posts
    274

    Re: [Advanced] How to trigger something after using a button for a period of time.

    Quote Originally Posted by Nih View Post
    If that was possible I've certainly wasted a lot of my time setting up this system The problem is that momentary_door doesn't register when it has been fully opened, so you have to create this work-around.
    Note that momentary_door is not the only entity that momentary_rot_button can trigger.
    Place a game_counter named "dooropener1" and set limit value to 1.0, then the game_counter will trigger its target when the momentary_rot_button is fully opened.

  6. #6
    Mapper Nih's Avatar  
    Manager
    Join Date
    Dec 2002
    Location
    Denmark
    Posts
    5,485

    Re: [Advanced] How to trigger something after using a button for a period of time.

    If that's true you've just made my tutorial obsolete. Thanks



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •