Need help for specific amount of overheal

Azsofe

L1: Registered
Aug 4, 2021
2
1
Hi I'm making a recreation of the MGE gamemode for a mini-game map, and i'm trying to set up the overheal gained after a kill.
I'm looking for exactly 150% of the health of the class, and so far I've only found ways to give a set number of overheal, not a percentage. I don't want to give 300 health to a scout against a soldier !

I've tried using addcond 73, with a AddOutput on !activator, with tf_add_or_remove_item_attributes and trigger_hurt, but all these methods give only a set number of overheal.

Is there a way to read the max health of a class and add overheal accordingly, or should I make a billion filters to list every matchups on each team ? Is there a simpler method, or should I give up and give a flat 50hp at respawn for all classes ?
 

Yaki

aa
Sep 3, 2018
422
261
So I'll answer the first question. There is no way to read max health in TF2, which is very, very unfortunate for us in the TF2 Maps community.

There is also no way to get 150% overheal (or anything else). The Healing Aura magic spell from Halloween (or, addcond 73) heals up to 200% HP.

For any other types of overhealing, here is what I might do:
  1. Simple Method
    You could add a max health attribute to the class (max health additive bonus), then with a delay use SetHealth to a high number (this is clamped at max health), then remove the max health attribute.
    To explain: The attribute for max health additive bonus would work like an item attribute, so it just adds onto the health. Then you would clamp the health to the highest value and then remove the bonus health.
    • This could potentially be expanded upon on a per-class basis (using filters and such, as you mentioned)
Here are some other methods for food-for-thought
  1. Use AddOutput to set !activator health to a set number.
    • i.e. for a trigger into a relay you could put
      • OnTrigger !activator AddOutput max_health #
    • Where # is the health you want. (i.e. "max_health 185" is the parameter)
  2. You could use the OnUser StartTouch method, which means you use AddOutput to add a FireUser1 to the player that forces the player to touch a trigger volume (i.e. an attribute) that will make the game think the entity is in the trigger volume (when it could be literally anywhere in the map)
    • To do this, use AddOutput "OnUser1 trigger_volume:StartTouch::0:1" (without quotes). If you already know about how to add an I/O to something, you only need to learn about StartTouch--This is the key here to making the game believe the entity touches a trigger.
    • You can use this in a myriad of different ways, as it's very flexible and limited only by your creativity (and, well, Source lololol). For example you could use it with the first mentioned method with max health additive bonus
I also wouldn't recommend using filters with OnPass/OnFail because those can crash the server if it doesn't have anything to filter (NULL can pass, which crashes the game). I personally would opt to use multiple triggers with filters for classes, that set to fire a relay that adds the StartTouch method, to then make the player touch a different trigger volume (or volumes) with filters for that volume.

Does that make sense? Please comment. We'll all try to help!


EDIT: oh, I just reread it and you wanted to detect on kill too? Look into trigger_brush combined with a Targetname. It says it's obsolete, but there is some code leftover that works in Source. You would name the trigger_brush after a Player Event (listed in the Targetname article) to get the desired output to fire.
 
Last edited:

Azsofe

L1: Registered
Aug 4, 2021
2
1
Hi, thanks for your reply ! I discovered your first method while messing around, and now I give 50 overheal at spawn :D
And now my mini-game is completed ! I've used a trigger_player_respawn_override with instant respawn time, which force respawn on 2 specific info_player_teamspawn (one blu and one red) with a trigger_teleport on top of it, that teleports to pseudo-random location (with a math_counter). When the respawned player touches a trigger_teleport, it activates the overheal process and a func_regenerate, plus it adds 1 to a counter.

I like your solution for a map-wide trigger, but unfortunatly since i'm making a multi minigames/trade map, I don't want to activate a overheal for everyone on the server.

Thank you very much for your help ! I will probably post my map soon, when i'm done with all minigames ;)