Button to toggle brush movement

Discussion in 'Mapping Questions & Discussion' started by Lopez, Dec 1, 2016.

  1. Lopez

    Lopez L1: Registered

    Messages:
    19
    Positive Ratings:
    2
    So I'm working on a jump map, and I've hit a snag with a secret that I'm try to add. Figured I'd ask you guys to see if what I'm trying to do is possible. I know you guys are good with all the quirks of hammer logic, so I figured I'd post here instead of the jump forum.

    I would like to have a button that, when damaged, causes a brush to move up and down indefinitely. And when damaged again the brush that's moving would freeze in place. I would also like to make it so that, when the brush is moving, a texture on the map changes to indicate that the button is activated. The texture would need to change back to the default texture when the brush isn't moving.

    Right now I have a button which toggles a logic_timer, which is set to toggle a func_door to open and close at a rate that makes the brush that's parented to it move up and down without stopping. The main problem with this setup is that the door will always return to the closed position, instead of freezing in place when the button is toggled off.

    I can provide pictures of the brushes and buttons in question, or a link to the .vmf if it would be helpful.
     
  2. Egan

    aa Egan

    Messages:
    1,318
    Positive Ratings:
    1,507
    You can use a func_movelinear instead which has outputs for OnFullyOpen and OnFullyClosed you can set to hit itself with Close and Open to loop forever in that order once you hit it initially with an Open (if it starts closed). And then just hit it with a 'SetSpeed 0' to freeze its current position.

    If you import multiple frames into a single vtf in vtfedit with its File > Import function (each frame being the same res) you can use the following vmt code to initiate a toggle texture:
    Code:
    "UnlitGeneric"
    {
        "$basetexture" "brick/wallsomethingidk"
        "$nodecal" "1"
        "Proxies"
        {
            "ToggleTexture"
            {
                "toggleTextureVar" "$baseTexture"
                "toggleTextureFrameNumVar" "$frame"
                "toggleTextureShouldWrap" "0"
            }
        }
    }
    This can be utilized in hammer with a env_texturetoggle point entity set to hit the textured brush you want to change. Then using either of the two inputs to set which frame of its texture to set it to (index starts at 0):
    IncrementTextureIndex Increments target brush's current texture frame by one.
    SetTextureIndex <integer> Sets target brush's texture frame to the specified index.

    For additional help remember to check this Help button in hammer for all entity io and kvs:
    [​IMG]
     
    • Thanks Thanks x 2
  3. Lopez

    Lopez L1: Registered

    Messages:
    19
    Positive Ratings:
    2
    Thanks for the help Egan, the func_movelinear works perfectly.

    I added a logic_branch entity that allows the func_movelinear to be turned off and on indefinitely, which gives a neat effect in game.
     
    • Like Like x 1
    Last edited: Dec 6, 2016
  4. Lopez

    Lopez L1: Registered

    Messages:
    19
    Positive Ratings:
    2
    I'm trying to get the animated texture to work, but I'm having trouble getting the texture into hammer. The vmt has

    "$basetexture" "onit/dev_measurewall01redblu"

    and the files are in custom/onit/materials, but when I load up hammer I just get a 64x64 texture of pink and black squares.