How to make trigger_hurt only damage once?

Discussion in 'Mapping Questions & Discussion' started by sooshey, Oct 14, 2016.

  1. sooshey

    aa sooshey :3c

    Messages:
    522
    Positive Ratings:
    418
    Is there a way to make a trigger_hurt (or something similar) that only causes a set amount of damage when a player first touches it? So it would behave like OnStartTouch > deal damage.
    Edit for clarity: I need the trigger to damage any player once each time they touch it, so disabling it won't work.
     
  2. Turnip

    aa Turnip The 80s Vegetable

    Messages:
    1,430
    Positive Ratings:
    795
    So you mean if sollymain#5993 touches it, itll hurt him once, then if medicmain#0001 touches it, it hurts him, but if sollymain#5993 touches it a 2nd time it wont hurt them?
     
    • Funny Funny x 1
  3. sooshey

    aa sooshey :3c

    Messages:
    522
    Positive Ratings:
    418
    Nah, it needs to hurt sollymain the second time too and all subsequent times. But only after he leaves the trigger.
     
  4. Turnip

    aa Turnip The 80s Vegetable

    Messages:
    1,430
    Positive Ratings:
    795
    By default the entity hurts anyone that touches it once if you set the damage type correctly, I think.
     
    • Respectfully Disagree Respectfully Disagree x 1
  5. sooshey

    aa sooshey :3c

    Messages:
    522
    Positive Ratings:
    418
    I thought it only damaged every half-second by default, and I can't figure out how to change that, if you even can.
     
  6. Izotope

    aa Izotope Never releases maps

    Messages:
    609
    Positive Ratings:
    571
    What you want can't be done with trigger_hurt, as far as I know.
    Let me introduce you to a nice little entity I believe not many around here know of: Point_hurt.
    You can specify to hurt in-range targets only once, or multiple times with a set delay.
    Here's how I'd do what you want:
    Make a trigger_multiple with the output OnStartTouch -> point_hurt -> Hurt.
    Make sure to set the target to hurt as "!activator".

    That's it, that's all there is to it.
    Let me know if you have problems with this!
     
    • Thanks Thanks x 1
    • Like Like x 1
    • Agree Agree x 1
  7. sooshey

    aa sooshey :3c

    Messages:
    522
    Positive Ratings:
    418
    Is there a way to parent the point_hurt to a moving entity? This would work perfectly if i could.
     
  8. Izotope

    aa Izotope Never releases maps

    Messages:
    609
    Positive Ratings:
    571
    Doesn't look like it, I'm afraid.
    Try increasing the radius over the entire map, and only parent the trigger to whatever you need.
    That should work, right?
     
    • Thanks Thanks x 1
  9. sooshey

    aa sooshey :3c

    Messages:
    522
    Positive Ratings:
    418
    That's a good idea, thanks! I'll try that.
     
  10. theatreTECHIE

    aa theatreTECHIE Yet another Techie for the net...

    Messages:
    389
    Positive Ratings:
    403
    Maybe try using a phys_constraint, similar to how a payload works.
     
  11. worMatty

    aa worMatty Repacking Evangelist

    Messages:
    1,072
    Positive Ratings:
    834
    trigger_hurt does its damage every half second. The pain value you set is halved, except for (I think) critical damage type which is doubled anyway. This behaviour can't be changed.

    OnStartTouch > !activator > AddOutput > targetname washurt > Delay of 0.1 second
    OnEndTouch > !activator > AddOutput > targetname canhurt

    ... and make a filter_activator_name for entities with targetname washurt and make the trigger_hurt test for it. Player walks in, gets hurt once, then gets 'renamed' (entity targetname only, not player name) to washurt so then the trigger_hurt stops causing it pain. Player walks out of the trigger, gets renamed to canhurt so the next time he walks into the trigger, it will hurt him once again.

    If a player dies in the trigger he won't be renamed to canhurt so you would need to put a trigger in each spawn room to rename them.

    If there was a way to deduct a specific amount of health from a player using logic, that would be great. Unfortunately we can only set them to a specific amount of health using SetHealth and AddOutput health. I use the latter to set players to 50HP in a deathrun map, in what I call the 'Low health challenge'. Players who take on this challenge must be very careful to minimise the damage they take from falling and other hazards. Perhaps you could send an email to the TF team asking them to consider adding a way to deduct a specific amount of health.
     
  12. Egan

    aa Egan

    Messages:
    1,307
    Positive Ratings:
    1,488
    Apparently the player inputs of 'BleedPlayer' and 'IgnitePlayer' can be followed by parameters for 'how long to keep the effect'.
    So OnStartTouch - !activator - BleedPlayer - 1 will bleed the player for 1 second causing 8 damage (on all classes). I tried dividing 1 by 8 to bleed the player for only 0.125 seconds for 1 point of damage, but 0.5 seconds seems to be the minimum causing 4 damage.

    Edit: I forgot to compile and that's why 2.0 seconds 'caused 12 damage' that one time. 2.0 seconds does cause 16 damage to all classes. And 2.5 seconds damages 20 which is an easy multiple to work with.
     
    Last edited: Oct 15, 2016
  13. worMatty

    aa worMatty Repacking Evangelist

    Messages:
    1,072
    Positive Ratings:
    834
    Wow that's cool! Thanks Egan!
     
  14. Izotope

    aa Izotope Never releases maps

    Messages:
    609
    Positive Ratings:
    571
    IgnitePlayer does not support preset times afaik, but can be removed with ExtinguishPlayer
     
    • Agree Agree x 1