How to make trigger_hurt only damage once?

sooshey

:3c
aa
Jan 7, 2015
514
410
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.
 
Jul 6, 2015
1,425
819
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.
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?
 

sooshey

:3c
aa
Jan 7, 2015
514
410
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?
Nah, it needs to hurt sollymain the second time too and all subsequent times. But only after he leaves the trigger.
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
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!
 

sooshey

:3c
aa
Jan 7, 2015
514
410
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!
Is there a way to parent the point_hurt to a moving entity? This would work perfectly if i could.
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
Is there a way to parent the point_hurt to a moving entity? This would work perfectly if i could.
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?
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
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.
 

Egan

aa
Feb 14, 2010
1,375
1,720
If there was a way to deduct a specific amount of health from a player using logic, that would be great.

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:

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
Apparently the player inputs of 'BleedPlayer' and 'IgnitePlayer' can be followed by parameters for 'how long to keep the effect'.
Wow that's cool! Thanks Egan!
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
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.

IgnitePlayer does not support preset times afaik, but can be removed with ExtinguishPlayer