trigger_add_or_remove_tf_player_attributes

MaccyF

Notoriously Unreliable
aa
Mar 27, 2015
915
1,545
Original post by FlaminSarge on Reddit


Sharp-eyed individuals might have noticed that the GitHub diff for the Tough Break update included stuff about "trigger_add_or_remove_tf_player_attributes".

It does as it says: adds/removes attributes to/from players.

Scroll down to the bold "Entity Info" if you just want the details on that.

Attributes are the modifiers attached to weapons or players, and their effects can range from modifying jump height or max health to swapping out projectile type (rocket minigun, anyone?) or doing this ("torso scale"). From here on, I'll refer to an attribute attached to a weapon as a "weapon attribute", and an attribute attached directly to a player as a "player attribute".

It's important to note that attributes usually have nothing to do with "conditions".

Weapon attributes are pretty clear-cut. Player attributes are used for things like the MVM Player upgrades, set bonuses (those still exist), Wheel of Fate effects (sometimes), and more recently, the Dalokohs Bar effect (which used to be a weapon attribute until Gun Mettle exploits forced them to rework how it did its thing). What's different about the Dalokohs Bar is that the +50 "hidden maxhealth non buffed" it adds has a timer associated with it, in a special type of player attribute that Valve has taken to calling "custom attributes". This new trigger adds "custom attributes" in the same way the Dalokohs does, with an attribute name, value, and duration.

Here's the list of attributes as of Dec 24, 2015 (very large page). For updates to the list, you'll have to navigate to the latest version of that file (or items_game, whichever floats your boat), which I don't have clear instructions for doing.

Entity Info

The entity has all your standard keys/inputs/outputs for triggers (e.g. filters, DisableAndEndTouch, etc.).

As such, here's the unique keys for Hammer (no unique inputs/outputs, it seems) as well as the Prop_Data names for SourceMod.

  • add_or_remove (m_bRemove) - leave at 0 to add the attribute specified, set to 1 to remove. I haven't been able to get this to work, but I'm using SourceMod so... eh.
  • attribute_name (m_iszAttributeName) - a string containing the "name" field of the attribute (as in the Schema linked above). SourceMod doesn't handle m_isz very well, so you'll need to use DispatchKeyValue.
  • value (m_flAttributeValue) - the floating-point value to set for the attribute. Unused if you're removing the attribute. Even if the value's an integer, you can usually just put it in as a float ("4" and "4.0" are the same, for instance). Some attributes don't adhere to this integer thing, but only those like "tradable after" or "kill eater".
  • duration (m_flDuration) - the amount of time in seconds that the attribute lasts. Unused if you're removing the attribute. Values of 0 or less seem to add the attribute for as long as the player is touching the trigger.
Pecularities

Valve set up attributes that affect weapons (like fire rate, reload time) such that if you add the attribute to the player, all the weapons that player has get the attribute, but if you remove the attribute from the player after adding it, the weapons don't necessarily update properly, even after a respawn. The remove function on the trigger doesn't seem to help either. The only thing you can do is get them to switch classes so that all their weapons get removed. In addition, once the duration for move speed expires, the player's speed doesn't update until they enter another one of these triggers (any attribute will do) or switches weapons, or gains condition 32 (the speed boost one). I usually add the speed boost condition for 0.01 seconds to force the speed update.

Also, the remove feature does not seem to work at all. This is for both the add_or_remove property AND for if you set the duration to 0 or less (so that it's supposed to remove when they leave the trigger). Neither of these work right now. Tell Valve, somebody, please.

I'll attempt to get a video up at some point. I'll also edit this post with further findings.
 
Last edited:

Egan

aa
Feb 14, 2010
1,378
1,724
april fools maps will be fun this year
YH5L9VZ.jpg


kYM1qDx.jpg


BjISrq1.jpg


llxMyuY.jpg
Using 'torso scale' and 'hand scale'

Edit:
4hIuUFj.png
 
Last edited:

Vel0city

func_fish
aa
Dec 6, 2014
1,947
1,589
This is in stock TF2 now.

What a time to be alive. Also, goodbye hitboxes. You will be missed pun intended
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
Beautiful, now they just need to add an option to remove for condition triggers as well.
 
Last edited:

Egan

aa
Feb 14, 2010
1,378
1,724
Beuatiful, now they just need to add an option to remove for condition triggers as well.

There is actually a trigger_remove_tf_player_condition. I keep forgetting to add it's contents to the VDC - actually I haven't even checked if it works.

Edit: Actually it seems it's officially in the fgd now, it used to not be.
 
Last edited:

henke37

aa
Sep 23, 2011
2,075
515
Wait, how do you get that second window?