I'm making a PvE server, and I want to make an individual variable for each mob to show their hp on their nametag. My current code is:
Basically I want a different variable to track the HP of individual mobs because the script I'm using right now makes the HP and MHP variables universal to mobs.
Code:
on right click:
if name of player's held item is "&2Undead Lure":
remove 1 green dye named "&2Undead Lure" from player's inventory
set {zombiespawned::%player%} to 1
spawn 1 zombie at player
set max health of last spawned entity to 20
set health of last spawned entity to 20
set {zombie_mhp} to max health of last spawned entity
set {zombie_hp} to health of last spawned entity
set display name of last spawned mob to "&7[Lv1] &2Zombie &c%{zombie_hp}%&7/&c%{zombie_mhp}%"
on damage of zombie:
if display name of victim contains "&7[Lv1] &2Zombie":
set {zombie_mhp} to max health of last spawned entity
set {zombie_mhp} to round({zombie_mhp})
set {zombie_hp} to health of last spawned entity
set {zombie_hp} to round({zombie_hp})
set display name of last spawned mob to "&7[Lv1] &2Zombie &c%{zombie_hp}%&7/&c%{zombie_mhp}%"
Basically I want a different variable to track the HP of individual mobs because the script I'm using right now makes the HP and MHP variables universal to mobs.