[SOLVED] Brush texture change?

  • If you're asking a question make sure to set the thread type to be a question!

N0VA

L1: Registered
Oct 16, 2016
23
4
I have been playing around with the death run format and i have been kinda experimenting with it.
One problem i would like to have solved is a way to change a brush its texture by an in-game output.

I'll explain it better:
I want a func_button that upon being used, to send an output to "ïtself" to change its texture to another one to indicate it has already been used. for what i have seen i need to use a point entity called env_texturetoggle. but now i am a bit stuck, you could say that it simply needs to "remove" the brush to have the red disabled one under it to appear giving the illusion that it has changed the texture.
But wouldn't that while both textures are active mess it up (you know that weird thing when 2 brushes with different textures clip in each other

I could not find much of help with google as its either very unclear or doesn't really answer my question.

As always your help is appreciated, thank you!
 

Micnax

Back from the dead (again)
aa
Apr 25, 2009
2,109
1,585
You could have two brushes, one hidden and one visible, than then switches the visibility of each when the button is pressed.

So button press: hide the green brush, show the red one
Want to reset it? hide the red brush, show the green one
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
You could try the Color input and make it red, this saves space unlike a custom texture (Not much but still!)
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
There is an easier way to change the colour of a button when it's pressed.

Create or use a material that is completely white, on your button brush. It can be a LightmappedGeneric (receives lighting and shadows) or an UnlitGeneric (doesn't receive light or shadows, but always glows with the same intensity. Used to make something look like a monitor screen). Then in the button's properties, set its FX Color to green using the value 0 255 0 or something similar.

qLDB9ca.png


Now give the button an output that changes its color to red when it's pressed.

maACym5.png


The !self target will cast spells... uhh, I mean will send outputs to the entity's self. You don't need to give an entity a name when you use this target.

If your trap is repeatable, and the button resets after a short time, you can use more outputs to change its colour back to green.

Note that the use of a white material is required, because if you try to change the colour of a material that's not white, it will make it look dark and horrible because it tries to colour something that is already coloured. In my screenshot I am using a custom material, but it doesn't use a VTF texture file, it just uses the colour value of white, which is why it doesn't have a preview and shows up as a checkerboard in Hammer. here is the VMT:

Code:
LightmappedGeneric
{
    "$color" "1 1 1"
    "%keywords" "tf,wormatty"
}
(This is equivalent to the colour 255 255 255. 0.5 0.5 0.5 would be 128 128 128. 0 1 0 would be 0 255 0).

I used a LightmappedGeneric for this button because I wanted to make it look moody because of the low lighting in the area.

7bhUZzT.png


D8C8AGT.png


Here's a tip: Hitting a small button with a melee weapon can be tough, especially when it's surrounded by other brushes. If you create another brush volume above your button, texture it with the nodraw material and tie it to the button so that they are both one entity, it will serve as a large hitbox to make trap activation much, much easier. The activator won't need to take their eyes away from the trap, and they will be able to activate it without any difficulty.

y7G3oVf.jpg
 

N0VA

L1: Registered
Oct 16, 2016
23
4
Thank you for your replies, i think i have found my solution, as for the hitbox. the button will be rather large since i know the pain of hitting a button with your melee (*AHEM* dr_sawmill, *AHEM* dr_trollrun) i will also make it somewhat transparent to give the "death" an easy view over the trap and where the players are.

One more curious question for you wormatty. What map is that?
 
May 25, 2015
390
307
You could also use the env_texturetoggle method, which allow you to use different textures that aren't just a solid color. You first need to create or find two textures obviously, and then make them both into a single VTF as an animation (this can be done either through vtex, or a third party program like vtfedit).
Then you have to set up your vmt with the proper proxies for toggling textures. You can find a link to the information you need here: https://developer.valvesoftware.com/wiki/List_Of_Material_Proxies#Entity_integration under the section TextureToggle.

You can then set up your env_texturetoggle in the map to point to your button brush and simply fire the IncrementTextureVar input to toggle the texture.
 

N0VA

L1: Registered
Oct 16, 2016
23
4
You could also use the env_texturetoggle method, which allow you to use different textures that aren't just a solid color. You first need to create or find two textures obviously, and then make them both into a single VTF as an animation (this can be done either through vtex, or a third party program like vtfedit).
Then you have to set up your vmt with the proper proxies for toggling textures. You can find a link to the information you need here: https://developer.valvesoftware.com/wiki/List_Of_Material_Proxies#Entity_integration under the section TextureToggle.

You can then set up your env_texturetoggle in the map to point to your button brush and simply fire the IncrementTextureVar input to toggle the texture.
Thanks, but a color change was all i needed :)
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
You're right. Sawmill is a nice-looking map with interesting traps, but those buttons are just silly.

One more curious question for you wormatty. What map is that?

The map in my screenshots is dr_steamworks_extreme. It's only being played on a small number of servers, since it's in beta and not published. I really should get around to finishing it, but I feel like rebuilding it from scratch.