Search Unity

Damage Areas

Discussion in 'FPS.Sample Game' started by devinpquinn, Mar 22, 2019.

  1. devinpquinn

    devinpquinn

    Joined:
    Aug 30, 2018
    Posts:
    8
    Hi,

    I've been playing around with the built-in Damage Area stuff for a little bit, but I can't seem to get it to.. damage players. It recognizes when a character enters it and all that, but never seems to actually get around to dealing damage to the player. I know I'm probably missing something simple here... if someone is able to clue me in, I will erect a small shrine to you in my residence and pray to your holy name every night before I go to bed.
     
  2. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    206
    LOL!

    Well with all the praise you will give to the helper, I may as well toss in an idea.

    I know when I was looking at the damage area code, it looked like the damage over time part was commented out, or UN-reachable due to an instant-kill option. So the damage areas in the maps just instantly kill the player, instead of ticking over time.

    But some of the tick over time code is still there, just figure out a way to enable it, instead of instant kill.

    Good Luck, Have fun!
    Micah
     
  3. karstenv

    karstenv

    Joined:
    Jan 12, 2014
    Posts:
    81
    I'm not sure what you have already tried but here is how we got them to work.

    We use them both as constrains to kill players leaving the map (instant kill) and as a health station (dealing negative damage :))

    First off you you should make an empty game object with a box collider on it.
    Set this collider to trigger and resize it to fit your area.
    The add the Damage Area script component and change the settings to fit you need.

    Now all you need are 2 entity components and it should all work nicely.
    Add Scene Entity (Script) and Game Object Entity (Script).

    Remember to save you scene before you build your level as the changes will not take effect if you don't.
     
    Toldam likes this.
  4. devinpquinn

    devinpquinn

    Joined:
    Aug 30, 2018
    Posts:
    8
    Awesome! Thank you both so much, I followed your advice and got it working exactly as I'd hoped. Good thing I budgeted for 2 shrines. Thanks again!