func_breakable outputting health remaining?

Ezekel

L11: Posh Member
Dec 16, 2008
818
245
is there a way to get a func breakable to send a value to a counter (or other entity) whenever it is hurt, giving either how much health it has left, or how much damage it has taken?

onhealthchange and ondamagetaken are the only outputs that refer to it's health, but how can i tell it to pass that onto the entity it's outputting too?
(i.e. in a similar way that you can send number of cappers on a payload caparea through to a logiccase for determining the payload's move speed)
 

MadMax

L1: Registered
Mar 25, 2009
32
20
ive been looking for the same thing, i remember someone doing it on TFC but that was done by a plugin for amxmodx.
 

zornor

L4: Comfortable Member
Jan 14, 2009
195
23
I haven't tested it but try OnHealthChanged -> math_counter -> AddOutput

get a game_text or whatever set up to show you if it's working
 

Zeewier

L9: Fashionable Member
Sep 20, 2008
619
262
OnHealthChanged also give the percentage as decimal

ex.

after damaging and the health of the object is 56% the OnHealthChanged will sent the 0.56 amount to the math_counter. (if wanted it to do that ofcourse :p)

If you used this counter you just have to select the counter as target and use a math_remap to remap it from the 0-1 range to the 0-100 range.
 

Ezekel

L11: Posh Member
Dec 16, 2008
818
245
You can also just send OnHealthChanged directly into a logic_case if you just want to set up events that occur at certain amounts.

that's how i originally planned to do it, only problem is that most weapons do damage in chunks (e.g. rockets, shotguns,etc), and usually more than 1point of damage each.

so if i have an event i want triggered when it has 200hp remaining, most of the time it will never happen, since you'll have a case of it being at 204hp, then take a rocket hit and be at 192hp or something.
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
Ah, right. Then you'd need to use a logic_compare for every event you want to occur, feed the input into all of them at once, and use the OnLessThan on each to do what you want.