How can I set a player's max health depending on their EXP level?
Solution 1:
This is a complicated system that you want to establish and requires the use of scoreboard objectives to function the way I think you want it to function. This is so that when a player reaches a certain level, in this case 1, they are given a health boost for as long as they are in that level. With any other effect this would be easily done but for the health boost you need to use a scoreboard objective system.
Step 1: Create An Objective
/scoreboard objectives add (Name Of Objective) dummy [Display Name Not Needed]
Step 2: Creating The Boost
These next commands need to be placed in a command block somewhere in the world set to repeat and Always Active for this to work at all times it is best if these are situated in the spawn chunks. If you don't know what these are or how to find them click here.
/scoreboard players add @a[l=1,lm=1,score_(Name Of Objective)=2] (Name Of Objective) 1 /effect @a[score_(Name Of Objective)=1,score_(Name Of Objective)_min=1] minecraft:health_boost 3 0 true
Step 3: Clearing The Effect
Now to get rid of that effect when the player no longer has the spesific levels required, these commands will also need to go into a command block somewhere in the world set to repeat and Always Active.
/scoreboard players add @a[l=!1,lm=!1,score_(Name Of Objective)=4, score_(Name Of Objective)_min=2] (Name Of Objective) 1 /effect @a[score_(Name Of Objective)=4,score_(Name Of Objective)_min=4] minecraft:health_boost 3 0 true /scoreboard players set @a[score_(Name Of Objective)=4, score_(Name Of Objective)_min=4] (Name Of Objective) 0
This should all work if I have done it right however I may have made a mistake so any feedback is appreciated.