How do you make endif mechanics?

mat_mot0

L2: Junior Member
Feb 11, 2018
88
4
I'm trying to make the mechanic in endif where, if a player is above a certain high one shot kills them instantly. I've been trying to recreate this multiple times with different attempt.

On my latest attempt, I made a box where if the player were to touch their health would be set to 32 making any airshot from that distance be able to kill them.

I used a trigger_multiple box with the output: OnStartTouchAll, target: !player, via this inpute: SetHealth, with the parameter override: 32.

It seems to have worked testing it in singleplayer with the only issue being that touching the box would propel you up for some reason. It did not work in multiplayer.

How should I go about to make the endif mechanic?
Any help is appreciated. Thank you.
 

Attachments

  • hlepplz.png
    hlepplz.png
    669.3 KB · Views: 163

Tiftid

the Embodiment of Scarlet Devil
aa
Sep 10, 2016
602
465
Use OnStartTouch and target !activator instead.
!player is intended for singleplayer games, and it won't work for this purpose, since it won't know to target the specific player who entered the trigger.
You should use OnStartTouch instead of OnStartTouchAll because with OnStartTouchAll, the output can't be triggered again until the trigger is empty of players, which would mean that players could escape the trigger by just having someone else enter it.

The reason why the box might propel you upwards is if you had more health than it was setting you too, then the engine might assume the trigger is dealing damage to you and therefore also needs to give you knockback. Avoiding this, if it's even real, is well above my pay grade.
 

Da Spud Lord

Occasionally I make maps
aa
Mar 23, 2017
1,339
994
A better way to go about this would be to give the airborne player a huge damage vulnerability, which would increase any damage taken to an amount guaranteed to kill. You could do this with a trigger_add_or_remove_tf_player_attributes set to add a "dmg taken increased" attribute to the player with a huge multiplier, and a duration of -1 to make it last until the player leaves the trigger. This has the benefit of not altering the player's health in case they survive, and not dealing knockback on entry (since no damage is dealt).
 

mat_mot0

L2: Junior Member
Feb 11, 2018
88
4
I can't find trigger_add_or_remove_tf_player_attributes, is it from an addon?
 

Da Spud Lord

Occasionally I make maps
aa
Mar 23, 2017
1,339
994
Hammer doesn't communicate directly with the game to know what entities are available and what they can do; instead it draws this information from FGD files, which are not always accurate. For some reason, trigger_add_or_remove_tf_player_attributes is not included in the stock TF2 FGD. Luckily, someone has made FGD code for it, which can be found here. If you have the ABS pack installed, I would advise copy-pasting this code into the bottom of tf-abs.fgd, located in your /Team Fortress 2/bin folder, using a plaintext editor such as Notepad.
 

mat_mot0

L2: Junior Member
Feb 11, 2018
88
4
Thank you, now I have the trigger_add_or_remove_tf_player_attributes. I set it to Add and the attribute to "Damage increases as the user becomes injured" and the duration to -1. What should I set the value to?
 

Da Spud Lord

Occasionally I make maps
aa
Mar 23, 2017
1,339
994
Thank you, now I have the trigger_add_or_remove_tf_player_attributes. I set it to Add and the attribute to "Damage increases as the user becomes injured" and the duration to -1. What should I set the value to?
Wrong attribute, you want "dmg taken increased" (just type that directly into the box, Hammer might correct that to something else automatically if its on the list you gave it). The value is the multiplier for any damage taken; that is, any damage taken by the player will be multiplied by that amount. So a value of 3 means a 100-damage grenade will actually deal 300 damage. To guarantee that any damage always kills, make it some ridiculously high number like 99999.