Health Bar for func_breakable? And damage filter?

Prettyman

L1: Registered
Mar 15, 2009
30
1
I'm making a map with a giant door that has to take a ton of damage before opening (about 10,000, to be exact). So far, I've gotten the door to work using a func_breakable, but I'd like there to be a health bar over the door to show how much health it has at all times. I was thinking of making a brush that scales itself in accordance with the health percentage, or something along those lines, but I don't know how to do this. Could somebody explain to me how I could make a healthbar?

Also, I'd like to make it so that only one team can attack the door. It sounds simple enough, but I'm unsure of how to do this as well.

Any help would be greatly appreciated! :)
 

lana

Currently On: ?????
aa
Sep 28, 2009
3,075
2,778
To answer the first, I don't think you can. It's impossible to track the current health of a func_breakable.

For your second however, use a filter_tf_team set to the team in question, and then set the damage filter of the func_breakable to that team.
 

Prettyman

L1: Registered
Mar 15, 2009
30
1
Thanks for the help! But is there any way at all to track something like that? With a different type of entity, perhaps?
 

tyler

aa
Sep 11, 2013
5,102
4,621
I would have thought there'd be at least one way to look at current health that'd enable you to send outputs. That's crazy.

(I have no idea, sorry, just bemused)
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
func_breakable > OnHealthChanged > func_movelinear > SetPosition

OnHealthChanged is a normalized output that gives the health value in a 0-1 range any time it changes, and SetPosition is a normalized input that arbitrarily moves the brush somewhere along it's path as a 0-1 value. Just stuff the movelinear in a slot or something and it will slowly slide into the wall.
 

Prettyman

L1: Registered
Mar 15, 2009
30
1
Alright, I tried it, and it kinda worked. The only problem is that when it first took damage, it would shoot down to zero, then fill back up to full as it took damage. Once the func_breakable broke, it would be back up to 100% again. So it basically worked backwards. Do certain parameters of the movelinear have to be set? Like start position or move distance?

EDIT: Nevermind, I got it to work.
 
Last edited:

Sergis

L666: ])oo]v[
aa
Jul 22, 2009
1,874
1,257
Well don't sit on your solution. Other people search these forums and could possibly have the same question. Add to the knowledge base!

This. I had problems setting up sourcemod and tried to find the answer in alliedmodders forums. 19 of 20 threads were ending in "ok i made it work". HOW IN THE ******* **** DID YOU ******* PIECE OF ******* **** MADE THAT ******* ******* **** WORK YOU ************???

something also can be in use for your door lo its very massive and blinded ... make it in multiple brush one in front of each other and reduce the hp of each litle door to make 1 large door ... so now people see how far they digged on the destruction of the door but if you realy found the way to show a hp bar ... i would know how you do it... and yeah my theory of the door in mutyple ply is not the best solution but a proposition.

imo its a lot more fun to break pieces off the object you need to break than just grinding one monolith without seeing any progress. I made a breakable throne consisting of ~20 pieces in my castle map and on most playtests half the defenders instead of defending were just breaking the throne (which they werent supposed to do because breaking it would give attackers extra time).
If you are going to make multiple pieces, remember to make sure that the object cant be broken in a way that will leave some pieces hanging in the air.
 
Last edited:

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
Well don't sit on your solution. Other people search these forums and could possibly have the same question. Add to the knowledge base!

Normally I'd agree with you, but it's pretty simple if anyone else had actually gotten to the same point. If the bar was moving the wrong direction you just need to change the start position value.
 

grazr

Old Man Mutant Ninja Turtle
aa
Mar 4, 2008
5,441
3,814
Or you could make the door out of several parts. Players don't need a health bar to determine damage done. Say the door is made of 4 or 5 pieces, over time/damage pieces fall off. It's not a perfect representation of damage, but players will get the idea.
 

Dragonhill

L1: Registered
Jul 9, 2008
29
7
func_breakable that heals itself

Hi,

I created a map called cp_reactor where players had to destroy a reactor core. The core would heal it self over time if it was not destroyed. There was one bug where the core would not stop healing it self (would not stop healing after 100%)

but i do not believe you really care about that part. I have a link to the logic part of the map

http://dl.dropbox.com/u/14514812/cp_func_health.vmf

It will take you a little to figure it out but it does work.

I use 7 CP points to display the health. In the beginning the map will activate all the cp points and turn them red (red defends). as damage is inflicted the right cap point will turn grey,,then blue,, then the next one will turn grey,,then blue

when all are blue the reactor is at 0% health and blu team wins.

The func breakable is the glass cylinder at the end of the room.

I hope this gives you something to work with.

No credit is required. But now the logic is out of the bag.
:D

~D