Arqade Asked by CommandNoob on August 1, 2021
I recently created a server from www.minefort.com, which is great, but the unfortunate thing is that those servers are unable to use forge mods, in my case, the X-life mod found here. However, I also know that the behavior of counting up hearts with death(so you have 1 heart on 0 deaths, 2 hearts on 1 death, etc.) is doable in the game with commands. To this effect, I’ve created a Deaths scoreboard variable which uses the in-game stats to determine how many deaths a player has. I also know that this command
/attribute @p minecraft:generic.max_health base set <insert health out of 20 here>
can be used to set health. To me, the easiest way of having that counting-up of hearts behavior would be something like
/attribute @p minecraft:generic.max_health base set 2*Deaths+2
as the health at any given amount of deaths is modeled 2 x Deaths+2, or 2(Deaths + 1). However, this does not work in a command, probably because I was kinda just guessing at the end of the command when it came to syntax. If anyone knows how to do this kind of mathematical operation in a command, it’d be greatly appreciated.
Vitality series:
Here is the /attribute
syntax:
attribute <target> <attribute> base set <value>
...which seems like it only accepts hardcoded values for <value>
.
This means that the only solution is something like this:
/execute if score @s Deaths matches 0 run attribute @p minecraft:generic.max_health base set 1
/execute if score @s Deaths matches 1 run attribute @p minecraft:generic.max_health base set 2
/execute if score @s Deaths matches 2 run attribute @p minecraft:generic.max_health base set 3
/execute if score @s Deaths matches 3 run attribute @p minecraft:generic.max_health base set 4
/execute if score @s Deaths matches 4 run attribute @p minecraft:generic.max_health base set 5
/execute if score @s Deaths matches 5 run attribute @p minecraft:generic.max_health base set 6
/execute if score @s Deaths matches 6 run attribute @p minecraft:generic.max_health base set 7
/execute if score @s Deaths matches 7 run attribute @p minecraft:generic.max_health base set 8
/execute if score @s Deaths matches 8 run attribute @p minecraft:generic.max_health base set 9
/execute if score @s Deaths matches 9 run attribute @p minecraft:generic.max_health base set 10
/execute if score @s Deaths matches 10 run attribute @p minecraft:generic.max_health base set 11
/execute if score @s Deaths matches 11 run attribute @p minecraft:generic.max_health base set 12
/execute if score @s Deaths matches 12 run attribute @p minecraft:generic.max_health base set 13
/execute if score @s Deaths matches 13 run attribute @p minecraft:generic.max_health base set 14
...
Correct answer by ginkgo on August 1, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP