- May 12, 2009
- 103
- 220
[Prefab] Counter - A clean-looking, versatile, and efficient counter prefab including custom materials and models.
It takes advantage of animated textures and material_modify_control entities to change the digits that are displayed. This is a more entity-efficient setup than the rotating brushes, and also has the advantage of being easily rescalable without any additional difficulties.
It's configured with relays that take in inputs to add 1 or subtract 1, but if you want to manually set the counter to something specific, you can change any digit to any number at any time, which wasn't possible before.
An in-depth tutorial on all of the techniques I used is coming soon.
Here's what you get when you download this zip:
Sure, feel free to use anything from the download in your maps, but please credit me.
How do I use this counter?
Make sure you have texture lock on, and place the prefab in your map. Then setup whatever entities you want to trigger the relays to add or subtract. Or, if you want to manually set it to a specific number, you can call SetValue on the counter for each digit.
Seriously, how the hell does this work?
The short answer is material_modify_control entities used in conjunction with animated textures to manually cycle through their frames. The long answer is I'm working on a more detailed tutorial that will explain how I used these entities to create this counter and everything else you can do with them as well.
Your prefabs only have two and eight-digit counters. What if I want a different number?
If you want less than eight digits, just chop off the ones you don't need. If you want more, just duplicate 4 entities for each digit as much as you need.
What if I want to make the numbers really big?
Just enable texture lock scale and resize the brushes that contain the digits until they're as big as you want them. Or you can do it manually.
What if I want to make the numbers a different color?
Open digit.vmt (in the custom materials folder) and change the $color variable to whatever you want it to be.
What if I want to make the numbers a different font?
If you know how to make an animated texture, just make one with the images for 0-9 as frames 0-9. If you don't know how to do this, ask me and I can probably help you out.
Help, whenever I add/subtract from the counter, it changes all the digits to the same thing instead of just updating one digit.
Each prefab contains a logic_auto with an output at the start of the map to forcefully sets every counter to zero and update the digit textures. Make sure you're not missing this output. Even though both the counters and the digits already default to zero, you will encounter this bug if you don't send them an initial input before you do anything else.
I want a sign with a different word on it so I can count something else.
If you know how to reskin an existing model, go for it. Otherwise, just ask me and I can probably help you out and make a new skin for you.
I have a question and it's not in this FAQ.
Post it here in the discussion thread or add me on steam and I'll get back to you as soon as I can.
[PREFAB] Wiseguy's Custom Counter, V1.0
While working on the next version of walkway, I ended up creating a much more efficient, pretty, and customizable counter that looks a little something like this:
It takes advantage of animated textures and material_modify_control entities to change the digits that are displayed. This is a more entity-efficient setup than the rotating brushes, and also has the advantage of being easily rescalable without any additional difficulties.
It's configured with relays that take in inputs to add 1 or subtract 1, but if you want to manually set the counter to something specific, you can change any digit to any number at any time, which wasn't possible before.
How it Works
An in-depth tutorial on all of the techniques I used is coming soon.
Download Contents
Here's what you get when you download this zip:
- A texture for digits 0-9.
- Blank sign models that come in two sizes and two team colors, to serve as a nice backing for the digits.
- A sign model with multiple skins for everything you might want to count, such as time, kills, deaths, points, and even hats.
- A prefab of the two-digit and eight-digit versions of the counter.
- A map (bsp and vmf) demonstrating a couple of basic uses for the counter.
- A readme file that most of you will never read.
FAQ
Can I use this in my map?
Sure, feel free to use anything from the download in your maps, but please credit me.
How do I use this counter?
Make sure you have texture lock on, and place the prefab in your map. Then setup whatever entities you want to trigger the relays to add or subtract. Or, if you want to manually set it to a specific number, you can call SetValue on the counter for each digit.
Seriously, how the hell does this work?
The short answer is material_modify_control entities used in conjunction with animated textures to manually cycle through their frames. The long answer is I'm working on a more detailed tutorial that will explain how I used these entities to create this counter and everything else you can do with them as well.
Your prefabs only have two and eight-digit counters. What if I want a different number?
If you want less than eight digits, just chop off the ones you don't need. If you want more, just duplicate 4 entities for each digit as much as you need.
What if I want to make the numbers really big?
Just enable texture lock scale and resize the brushes that contain the digits until they're as big as you want them. Or you can do it manually.
What if I want to make the numbers a different color?
Open digit.vmt (in the custom materials folder) and change the $color variable to whatever you want it to be.
What if I want to make the numbers a different font?
If you know how to make an animated texture, just make one with the images for 0-9 as frames 0-9. If you don't know how to do this, ask me and I can probably help you out.
Help, whenever I add/subtract from the counter, it changes all the digits to the same thing instead of just updating one digit.
Each prefab contains a logic_auto with an output at the start of the map to forcefully sets every counter to zero and update the digit textures. Make sure you're not missing this output. Even though both the counters and the digits already default to zero, you will encounter this bug if you don't send them an initial input before you do anything else.
I want a sign with a different word on it so I can count something else.
If you know how to reskin an existing model, go for it. Otherwise, just ask me and I can probably help you out and make a new skin for you.
I have a question and it's not in this FAQ.
Post it here in the discussion thread or add me on steam and I'll get back to you as soon as I can.
Last edited: