Removing attributes with trigger_add_or_remove_tf_player_attributes not working

  • If you're asking a question make sure to set the thread type to be a question!

Penguin

Clinically Diagnosed with Small Mapper's Syndrome
aa
May 21, 2009
2,039
1,484
Hey all,

Is the remove function of this entity known to be bugged? I have been trying to remove the "can't hold the flag" attribute from all players (IE players who have the rocket jumper) and it simply does not seem to work.

Is there some special secret to getting it to function as advertised?
 

Yaki

aa
Sep 3, 2018
416
254
The remove part is non-functional. The way to remove any attribute like that is to set the Duration to 0.

However I'm not sure how to solve your particular problem. It sounds like the attributes don't update at all if the duration is set to 0? And persist between respawn lives... I would just play around with it.

(If you want to take a further look into the bugs, here is some more info it: https://www.reddit.com/r/tf2/comments/3y54wu/for_mappers_trigger_add_or_remove_tf_player/)

EDIT: I think you can remove an attribute that's additive (like cannot hold flag) by setting it to subtract the attribute (i.e. set the Value to -1).
 

Penguin

Clinically Diagnosed with Small Mapper's Syndrome
aa
May 21, 2009
2,039
1,484
So you're saying I can ADD the attribute with a Duration of something really small (0.1), which will remove it from both cases where we just added it, and cases where it already exists, when the time expires?
 

Yaki

aa
Sep 3, 2018
416
254
I'm wondering if setting the value to any integer that isn't 0 will make it remove the attribute correctly or not. I don't know, please play around with it.

I'm sorry for double-posting.

(EDIT: If you do remove any attribute, setting the Duration Value to 0 is totally valid in the system. It'll add and remove it in the same instant)
 

Penguin

Clinically Diagnosed with Small Mapper's Syndrome
aa
May 21, 2009
2,039
1,484
much to think about, thanks for the knowledge. i will try many things and report back.
 

Yaki

aa
Sep 3, 2018
416
254
Yeah, sorry there was a contradiction to what I said, about the duration not removing already-existing attributes. So let me be clear:
  • Setting the Duration to 0 will remove the attribute or condition (from trigger_add_tf_player_condition)
  • Because the attribute cannot pick up intelligence is additive, you can remove it with a simple subtraction value (like -1). (multiplicative ones that say percentage or something similar, would need a value of 0 because they are multiplied not added/subtracted)
    • More on this note, the thing I do not know is if they apply to all weapon's attributes or if it's on the base character that it's added. (think MvM in buying resists--those are applied to the base character)
  • And lastly, for attribute cannot pick up intelligence , I don't know if it'll prevent picking up the flag if it is set to -1 on other classes.
 

Penguin

Clinically Diagnosed with Small Mapper's Syndrome
aa
May 21, 2009
2,039
1,484
OKAY SO a quick test of Adding that Attribute with a value of -1 yields unexpected results. It seems like it negates/inverts the status of the attribute.

My test was as follows: I spawn in as a Demoman with Stickyjumper, alongside 3 bots with default items. I ent_fire a map-sized trigger that spawns an item_teamflag at a template for all activators. I am able to pick up the flags, but no one else is. Bizarre stuff. I'm going to try a value of 0 next.

EDIT:

Value of ADD 0 doesn't seem to do anything. I was thinking the attribute might have been multiplicative given the above results, but that doesn't seem to be the case... hum.

EDIT 2:

I was thinking, maybe if I just flicker the trigger when the flag is spawned (IE, enable/disable twice in rapid succession), I can invert the inversion. The first cycle would allow Sticky Jumpers to pick up the flag while disallowing everyone else, and the second cycle would re-invert things back to the original state. However, it doesn't seem to work that way.

I also tried enabling a trigger with Value -1 and Duration 0, then enabling one with Value 1 and Duration 0. This also doesn't seem to work. I wish there was a way to visualize the numeric state of the attribute on each player.
 
Last edited:

Box Of Paper

L3: Member
Jul 15, 2019
111
142
Nope, not possible (I'd love to be proven wrong tho).
EDIT: Looks like I didn't test enough, adding the attribute "cannot pick up intelligence" with a value of -1 actually nullifies the stickbomb launcher's one.
The attribute still blocks whoever has it from picking up the intelligence even if it's set to -1, it's a 0 = false and everything else true situation.

...​

I guess take the following as an explanation of how it works with pictures...

...​


god bless mvm upgrade station:
demo_no_carry.png
The attribute is added to the player, using the "remove" function removes THIS attribute.

--------------------------------------------------------------------------------------------------------------------

From further experimentation:
medic_milk_doesnt_work.png
This however doesn't work, it only works if it's given to the weapon itself (at least that's what I got from testing).

This also doesn't work
engi_mini_sentry.png

--------------------------------------------------------------------------------------------------------------------


sniper_tracer.png
sniper_rifle_tracer.png
smg_tracer.png
Ok so this one works, however removing kinda doesn't, I don't know what goes on behind the scenes, but the tracer won't be removed unless you fire one last shot while scoped, thus making it impossible to remove it with any weapon but the sniper rifles.

More examples:
soldier_spread.png
cow_mangler_spread.png
bison_spread.png

This one also works but screenshots were too hard to take, it increased bullets for both minigun and shotgun:
heavy_more_bullets.png
 
Last edited:

Penguin

Clinically Diagnosed with Small Mapper's Syndrome
aa
May 21, 2009
2,039
1,484
I got a working solution.

I parent an individual trigger to the flag that Adds the "cannot hold intel" attribute with a value of -1, activated on a 0.05 second delay. When the flag is instanced on top of a player, they will pick it up instantly, rendering the trigger useless. Unless they have a weapon that has the "cannot hold intel" attribute, in which case they pick up the flag 0.05 seconds later, when the trigger activates on them allowing them to pick up the flag.

Respawning seems to reset values, making this repeatable behavior.
 
Last edited:

Box Of Paper

L3: Member
Jul 15, 2019
111
142
Welp
worked.jpg

They DO sum!

Looks like I didn't test enough, the two attributes CAN cancel eachother!
data.png
 
Last edited: