I'm trying to run commands on the condition that the executing player is at full health. The problem is, in this datapack, a considerable amount of players will not have the default Max Health attribute of 20. It can range anywhere from 6 to 40, for example.
I've tried to run a function referencing the player's Attributes data, but the issue is that the player's total value of any given attribute, including the base value and any modifiers, isn't stored anywhere, so I can't figure out how to reference just the total value.
In summary, I need a way to find out if a player's current health is equal to their maximum possible health, including all attribute modifiers. Is there a way that I can do this?
attribute
command. Especifically the "base get" versionexecute store result score @s max_health run attribute @s generic.max_health base get
to retrieve the attribute, and the write it to the max_health score. I just can't seem to figure out how to total all the modifiers as well, since it seems like I'd need to run that command with every individual modifier ID to get the total. (Edit: I've seen your other response, and that fixes all the issues I was worried about. Thanks!)