Changing a texture ingame (Texture_Toggle?)

Avatar
The_Butler
31 Posts
Posted Sep 25, 2012
Time for a good oll' obvious question.

I am trying to get a countdown timer on a wall, and I want to use the "effects/countdown_timer_num_0n"
textures that come with Portal2. I thought a good start would be to see how normal indicator lights change their texture, but the tutorial is not making that overly clear. I then stumbled upon the Texture_Toggle function https://developer.valvesoftware.com/wiki/Env_texturetoggle but I am now even more confused... it is going on about VTF files - and that you must have a VTF file in order to use texture toggle...

so a few beginner's questions, when I go to textures, and I browse.. that is what I get isn't it - just textures, little drawn up pictures that have no logic or features attached?

To solve this, surely I need to create some sort of object that has all 11 states / frames that my number can have (NULL,0,1,2...9) and by firing a number at the object it will display on the wall?

how come the blue indicator lights just work, when I browse for them I can't see the Yellow variant anywhere, just the blue strip - how could I find out without tutorials that these lights can turn "on"?

I'm also using a math counter and a logic timer to get my counter going - is this the correct way of ding things of should I consider using a script instead?

many thanks for your patience gents, I'll get there one of these days

Advertisement
Registered users don’t see ads! Register now!
Avatar
Lpfreaky90
2,842 Posts
Posted Sep 25, 2012
Replied 30 minutes later
What you see in the texture browser is all the materials portal 2 has.

A material is a vmt file that has information, like
$basetexture, which is the .vtf file, the actual image itself.

If you go to the indicator light textures, you will notice that the vtf has multiple frames with textures in one file. The env_texturetoggle allows the game to switch to the specified frame, basically changing the entire image.

The numbers however, are not all in one vtf, so switching between them is a hell. Chickenmobile made a nice timer a long time ago, look for it in the other section of portal 2 :biggrin:

Avatar
ChickenMobile
2,460 Posts
Posted Sep 25, 2012
Replied 20 minutes later
I say!

Just toggle brushes on and off with your desired textures.
That's what I did for this: Underground Timer

Avatar
The_Butler
31 Posts
Posted Sep 25, 2012
Replied 24 minutes later
Thanks for the info Lpfreaky90, that makes it a bit clearer for me!

RoboChicken, wow nice one. I will delve into that one tonight when I get home.

Avatar
The_Butler
31 Posts
Posted Sep 25, 2012
Replied 5 hours later
I have the timer happily ticking away in my level, forgive me if I am being thick though, but I don't understand the interaction with logic relays... I have two relays that will enable / disable a light wall; how do I reference to these via your button stand and timer panel? I tried following your tutorial....

lets say my relays are called "LR_Wall_On" and "LR_Wall_Off"

both button and wall panel are called "Timer_01" (Entity name fixup)

....

never mind, writing down what I have got in Hammer made me see my mistake, the logic relays are called "fixup" - "logic relay name" whohooo

right, back to making my map... I promise one day I will publish one... soon

Avatar
ChickenMobile
2,460 Posts
Posted Sep 25, 2012
Replied 4 hours later
You could also use an '@' symbol so then you don't need the prefix name things like I said: but I think it helps people understand it a little as well.
Avatar
josepezdj
2,386 Posts
Posted Sep 27, 2012
Replied 1 day later
You can also make a custom timer with your own number textures. I'm doing myself one for the mod using our numbers and typo. You can make your own .vtf file with the 10 numbers as frames into the same file, always bearing in mind the limitations that a vtf file could have (for some games that's 512kb max. / 256x256px... dunno for Portal2 though).

The rest is relatively easy using logic_timers and env_texturetoggles (and whatever outputs to activate the count... There an interesting output applicable to the env_texturetoggle called "IncrementTextureIndex" that could be fired every second to change to the next texture/number)

A second option would be to make directly an animated spray. You have an awesome tutorial for that HERE; 2 methods are explained indeed...

Avatar
The_Butler
31 Posts
Posted Sep 27, 2012
Replied 2 hours later

josepezdj wrote:

There an interesting output applicable to the env_texturetoggle called "IncrementTextureIndex" that could be fired every second to change to the next texture/number)

That was exactly the option I was looking at; it looks elegant and well, just the proper way to do it. Although very greatfull for Chicken mobile's counter I am not happy with the fact that I have not "learned" something new with all this - so maybe I might have a go and try your way... but first, first i will finish at least one map, even if it kills me....

Avatar
josepezdj
2,386 Posts
Posted Sep 28, 2012
Replied 15 hours later

The_Butler wrote:
Although very greatfull for Chicken mobile's counter I am not happy with the fact that I have not "learned" something new with all this

I guess working with instances, and to know what's happening inside them, is a bit more for advanced mappers. However, even thought I haven't checked Chicken's underground timer, I know it is an awesome tool very well configured, intuitive and useful. Working with instances allows you to have it all already set up and vary only certain general values from time to time you use the instance... like in this case the amount in seconds to count up or down and the event you want to happen after the time has come.

I also like to know what happens, to know it by myself, and to make it happen myself. That's why I like hammer this lot :biggrin:

I'll try to take some of my little free time to make an example mini map with a working timer in it but the way I said above, no instances, just the entities and the multi-framed texture files, in order to make a more didactic thingy where you can see what is happening between each entity clearly.

Avatar
ChickenMobile
2,460 Posts
Posted Sep 28, 2012
Replied 3 hours later
Hey if you have any questions related to the timer, just ask. Not hard :razz:
Avatar
The_Butler
31 Posts
Posted Sep 28, 2012
Replied 5 hours later
I'll hold you to that Chicken :smile:
I must say, this forum is so much more easy going than the usual tech related forums out there on the web.. usually going off topic or asking two questions in one thread will be punished my the angry moderators, and newbies are treated like paria's...

Anyway, I am sticking with Chickens awesome :thumbup: timer. Maybe in the future I will take it apart to see how the internals all work [edited 28/09/12]

Cheers!

Avatar
josepezdj
2,386 Posts
Posted Sep 29, 2012
Replied 1 day later
OK, I managed to make a couple of timers using the idea I mentioned above (go changing the textureindex of the .vtf overlay file with the numbers). I think it's pretty simple and the .vmf is really clear...

Check it HERE if you're interested. I hope it's useful :biggrin:

Advertisement
Registered users don’t see ads! Register now!
Avatar
The_Butler
31 Posts
Posted Oct 01, 2012
Replied 1 day later
Thank you josepezdj, I've downloaded the file but not looked at it; not had much chance to mod during the weekend, but I did get my custom made flip-up panel working all by myself (and with help from a youtube tutorial). The major problem now is; I forgot what I had in mind as the final puzzle element! so I am now back at sorting that out. When done I will revisit the looks of my map and hopeful implement a nice timer :smile:

thx for the help!