Health Bar for func_breakable? And damage filter?

Discussion in 'Mapping Questions & Discussion' started by Prettyman, Jan 30, 2011.

  1. Prettyman

    Prettyman L1: Registered

    Messages:
    30
    Positive Ratings:
    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! :)
     
  2. Lancey

    aa Lancey Currently On: ?????

    Messages:
    3,076
    Positive Ratings:
    1,314
    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.
     
    • Thanks Thanks x 1
  3. Prettyman

    Prettyman L1: Registered

    Messages:
    30
    Positive Ratings:
    1
    Thanks for the help! But is there any way at all to track something like that? With a different type of entity, perhaps?
     
  4. tyler

    aa tyler snail prince, master of a ruined tower

    Messages:
    5,031
    Positive Ratings:
    3,975
    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)
     
  5. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,515
    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.
     
    • Thanks Thanks x 2
  6. Prettyman

    Prettyman L1: Registered

    Messages:
    30
    Positive Ratings:
    1
    Thanks, Boojum Snark! I'll give it a try!
     
  7. Prettyman

    Prettyman L1: Registered

    Messages:
    30
    Positive Ratings:
    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: Jan 30, 2011
  8. What Is Schwa

    What Is Schwa L6: Sharp Member

    Messages:
    375
    Positive Ratings:
    220
    Well don't sit on your solution. Other people search these forums and could possibly have the same question. Add to the knowledge base!
     
    • Thanks Thanks x 1
  9. Sergis

    aa Sergis L666: ])oo]v[

    Messages:
    1,871
    Positive Ratings:
    1,130
    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 ************???

    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.
     
    • Thanks Thanks x 1
    Last edited: Feb 2, 2011
  10. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

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

    aa grazr Old Man Mutant Ninja Turtle

    Messages:
    5,436
    Positive Ratings:
    3,557
    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.
     
  12. LeSwordfish

    aa LeSwordfish semi-trained quasi-professional

    Messages:
    4,102
    Positive Ratings:
    5,990
    Grazr's idea is probably visually better.
     
  13. Dragonhill

    Dragonhill L1: Registered

    Messages:
    29
    Positive Ratings:
    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