Damage-Based Door and func_breakable?

Prettyman

L1: Registered
Mar 15, 2009
30
1
I'm trying to make a small door that opens after a certain amount of damage is dealt to it (example: 1000, using a func_breakable over the door), and inside of that door is another func_breakable that also activates after it takes a certain amount of damage (let's say 750). If that amount of damage isn't done to it in a certain amount of time (about 10 seconds) I'd like the securing door to close, and have the damage necessary to the door be reset. If the damage is done in the allotted time, I want another door on the map to stay open for a short time frame (about 30 seconds), then close, and reset the damage entites.

So my question in shor is;

Is there a way to have a func_breakable be broken multiple times? Or reset after a certain period? Or even regenerate health?

I know it's a complex question, but any help would be greatly appreciated.
 

Toomai

L3: Member
Apr 14, 2011
129
144
According to the wiki page, the SetHealth, AddHealth, and RemoveHealth inputs can be used to tweak a func_breakable's current HP, and you can use the OnTakeDamage or OnHealthChanged outputs to detect when it gets hit. However, nothing is listed about resetting a func_breakable, so I would assume it's not possible.

If you wanted to be tricksy though, you might be able to do this: Set its pressure delay to a big value so it doesn't immediately break when its health gets to 0, then disable it to give the appearance of being broken. Then change its health later to a positive value before the pressure delay expires. No idea if it'll work, and will never produce gibs, but worth a try.
 

TMP

Ancient Pyro Main
aa
Aug 11, 2008
947
560
A while back, I had a system where I wanted a func_breakable to never actually break, but to be able to monitor damage. So I worried about 32 demos placing stickies next to it.


Basically, I had the func breakable have 20x as much HP as I wanted it to and I did the OnHeathChanged output and checked if the health was less than 95% of its full. When it was, I would do the actions and give it full HP. In your case, you could give it full HP after you destroyed it, hide it with a func_movelinear or something, and then later on just shove it back out. At the same time I'm not quite sure what you want.

But if you want a reusable func_breakable to monitor damage, the way I suggested was how I did it two years ago.
 

Beesafree

L1: Registered
Jun 11, 2011
32
4
couldn't you have a regular func door with a block in fron of it (block bullets like one unit in front of it, so this would take damage) and then use an output on the block bullets like this:

my output named: ----------onbreak
target entities name: ------(the door)
via this input: -----------------open

EDIT:

for everything

things i'll be refering to:
physbox, mover (for coding and counting purposes)
image1, door1 (one to be destroyed in 10 seconds)
image2, door2 (security door that blocks the one to be destroyed in 10 seconds)
image3, door3 (one that stays open)

the three images wont be mentioned (just because there is no code attached)
the 3 doors are the coding to the doors (the Func_door)
mover is a parent of physbox, which i made a func_movelinear (this is to hide the breakable part when not in use, move it up or down quickly through the skybox)
physbox, with 200000 hp (almost positive impossible to destroy with 448 crit stickies) make the health level to overide motion at 200000 - hp of the door (750 in you example so...) = 199250. (this should be block bullets material for best results)


physbox code:
OnMotionEnabled, counter, sethealth, 200000
OnMotionEnabled, door1, open
OnMotionEnabled, mover, open
OnMotionEnabled, counter, DisableMotion, 0.3 delay
OnMotionEnabled, door1, close, ??? delay
OnMotionEnabled, door1, close, 30 delay
ondamaged, door2, close, 10 delay ----------------(this will always happen as is, a timer can fix this)
ondamaged, door2, open, 10+?? delay


door2 code:
onclose, physbox, sethealth, 200000

door1 code:
onopen, door3, open
onopen, door3, close, delay 30 seconds

EDIT:
here's my example file (all the files, dunno what were needed)
red is the mover
chainlink is the hysbox

http://www.mediafire.com/?rwbw62bajks3y56
 
Last edited: