func_breakable outputting health remaining?

Discussion in 'Mapping Questions & Discussion' started by Ezekel, May 6, 2009.

  1. Ezekel

    Ezekel L11: Posh Member

    Messages:
    818
    Positive Ratings:
    244
    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)
     
  2. MadMax

    MadMax L1: Registered

    Messages:
    32
    Positive Ratings:
    20
    ive been looking for the same thing, i remember someone doing it on TFC but that was done by a plugin for amxmodx.
     
  3. zornor

    zornor L4: Comfortable Member

    Messages:
    195
    Positive Ratings:
    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
     
  4. Zeewier

    Zeewier L9: Fashionable Member

    Messages:
    619
    Positive Ratings:
    130
    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.
     
  5. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,527
    You can also just send OnHealthChanged directly into a logic_case if you just want to set up events that occur at certain amounts.
     
  6. Ezekel

    Ezekel L11: Posh Member

    Messages:
    818
    Positive Ratings:
    244
    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.
     
  7. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,527
    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.