Started by
Cleff.
on
Topic category: Help with Minecraft modding (Java Edition)
Hey, I need some help making a mod for my friend. I'm trying to create an item that when used increases your max HP by 2 (1 Heart.) I already have an attribute command set up that increases your HP from (10) (13) (Which is 10 to 11 hearts) and am confused about how I could increased this so the more of the item used the more health you are given. Thank you!
attribute @p minecraft:generic.max_health base set 13
You could try making a new variable called "Max Health" (or anything you want, as long as you remember what it means), set to:
Variable type: number
Variable scope: player_persistent
Then set the initial value to 10, and make a procedure so that whenever you use the item, it increases the variable by however much health you want it to add (so +2 for an extra heart).
Lastly, make a procedure that sets your max health to the number that the variable is set to.
I'm not 100% sure if that will work, but feel free to try it and ask me if it doesn't!
Oh my gosh thank you so much for helping! I'm fairly new to modding and this is a pretty big thing for me. I haven't used variables too much but I've figured some things out. How exactly to I change or add numbers to the variable through a procedure? Thank you!
Also, I would just like to add about how I would convert the variable to the maxhealth of the player. Which block would I use?
You have to make a second variable that holds the words of your command
Thank you!