DJ music buttons

Discussion in 'Mapping Questions & Discussion' started by KlashFire, Sep 10, 2015.

  1. KlashFire

    KlashFire L1: Registered

    Messages:
    17
    Positive Ratings:
    1
    I have a few buttons in a "disco" room in my map. In theory it was easy, but I encountered a LOT of bugs I don't know how to fix.

    the layout is that there are 5 buttons, each plays a different song upon being hit. to avoid 2 ambient_generics being played at the same time, causing mass lag and "ear rape" - I have made it so that once one button is pressed, the others also press in. all of them press out when the song finishes (if the song finishes after 3:12 minutes, I made the delay before reset to 192 and outputs on other buttons to press out after 192 as well)

    here are the problems:

    1. the buttons will sometimes unpress at the wrong times i.e. one button will unpress 50 seconds before the song finishes and others might unpress 5 seconds after the song ends although all were given the same time
    2. if you use an explosive projectile, you can press 2 buttons at once, making 2 songs be played at the same time, which I want to avoid at all costs
    3. I attached a env_hudhint to all the buttons, so that the player who presses the buttons can see the song and artist. they don't show up.
    thanks in advance

    well, here is my VMF file:
     

    Attached Files:

  2. KlashFire

    KlashFire L1: Registered

    Messages:
    17
    Positive Ratings:
    1
    didn't let me upload .bsp file for some reason, so it might be difficult to show you the problems
     
  3. Tumbolisu

    aa Tumbolisu  I ⌄ I 

    Messages:
    934
    Positive Ratings:
    901
    Is 5 am. Tumbo tired. Tumbo give you thing he made that also has buttons that make music play.
    Does not solve problem 2. If you want solve problem 2, each button needs a slightly different delay on all of its outputs.
     

    Attached Files:

    • Thanks Thanks x 3
  4. KlashFire

    KlashFire L1: Registered

    Messages:
    17
    Positive Ratings:
    1
    `oh, I was wondering for a very long time if * worked as a wildcard in hammer, never bothered to try it since I thought it was a ridiculous thought. thank you for teaching me something. this solves a lot actually.

    klashfire thanks Tumbo for his brilliant incite and taunts Tumbo since by his time it's only 11:16 PM
     
  5. worMatty

    aa worMatty Repacking Evangelist

    Messages:
    1,072
    Positive Ratings:
    832
    If you give each button a slight delay on their music play back outputs, they will still be fired, but at a slight delay. You need to prevent the outputs being fired, which means either offloading them to logic_relays that can be disabled before they are triggered, or using more button logic.

    To prevent multiple tracks from being played simultaneously due to weapons fire:

    Method 1:

    Use the OnIn event for the sound playing output for each of your buttons. That fires the output when the button has finished pressing inwards.
    Give each button a slightly different speed so that if more than one are hit at the same time, then one of them will fire its output before the others.
    Name each button the same thing and give them each the output: OnIn > button name > Lock. If a button is Locked before it finishes pressing in, its output will not fire.
    Just unlock the buttons when they become available again.

    Method 2:

    Set up a math_counter, give it a maximum value of 2. Tell each button to add 1 to the math counter when they are pressed. Give the math_counter an output, OnHitMax > Stop all the sounds and reset the buttons.
    Remember to reset the value of the math_counter to 0 when a music track has been chosen successfully, or as the buttons are about to be reset.

    ^ Thanks to Vincentor for number 2.
     
    • Thanks Thanks x 1
  6. KlashFire

    KlashFire L1: Registered

    Messages:
    17
    Positive Ratings:
    1
    I'm not too good with logic_relay and logic_branch, any logic indicators. still learning.

    would I put a delay on the output of the button which triggers the relay or on the relay itself and trigger it immediately once the button is pressed?
     
  7. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,527
    Make a turny-thing that all the buttons are on so only one can be seen at each time. Have another thing that turns the turny. Make custom textures to label each button rather than using hud hints (pretty sure broken in tf2). Fancier that way.

    ...at least, that's what I might do.
     
    • Thanks Thanks x 2
  8. KlashFire

    KlashFire L1: Registered

    Messages:
    17
    Positive Ratings:
    1
    oh, fancy and cool, I like. hud hints are a tiny bit broken, hardly ever used, but the only game text that is localized, so whatever. (I got my hudhints working in the end)
    will be a lot of work, but I can probably make something like that. gonna steal your idea now.

    how I could do this w/o a "turny thingy":

    I would probably make this inside a brush (make a hole inside a brush and put a panel there).
    make arrows on right and left which changes the panels. add a math_counter so that it can only go right and left to a certain point.
    add a play and stop button, so that they can then play the song they want instead of it auto-playing once scrolled.

    done correctly, this theoretically, could solve all the problems I've been having. it would be impossible to to hit more than one song at a time and the delay is a separate function so no logic_relays are needed to delay the song.
     
  9. KlashFire

    KlashFire L1: Registered

    Messages:
    17
    Positive Ratings:
    1
    was thinking of making a func_linear, maybe a func_tanktrain or func_traintrack, then I realized I could just make it a button, press it in all the way to the right, then pressout when I chose that option on the arrows. might have some disadvantages I'm not aware of though
     
  10. obodobear

    obodobear L4: Comfortable Member

    Messages:
    160
    Positive Ratings:
    27
    can anyone tell me how to make OnIn work? i have it all set up with everything else but when i hit the button nothing plays... The sound works with ondamage but if u hit another button it lags the game like crazy and the music stops
     
  11. obodobear

    obodobear L4: Comfortable Member

    Messages:
    160
    Positive Ratings:
    27
    If you want to look at the map file here it is, u will find the dj room in a small structure on top of a big structure underneath the map
     

    Attached Files: