I am working on a old project, and its a reasonably sized one. the problem that I have is the hearts wont calculate correctly. (may or may not be because im on bedrock)
Code:
on join:
if {points::%player's uuid%} is not set:
set {points::%player's uuid%} to 0
set {points::%player's uuid%} to player's level
if {bounty::%player's uuid%} is not set:
set {bounty::%player's uuid%} to 0
if {kills::%player's uuid%} is not set:
set {kills::%player's uuid%} to 0
if {deaths::%player's uuid%} is not set:
set {deaths::%player's uuid%} to 0
while player is online:
if {points::%player's uuid%} is not set:
set {points::%player's uuid%} to 0
set title of player's scoreboard to "&x&0&8&4&C&F&BB&x&1&A&5&F&F&Be&x&2&D&7&1&F&Bt&x&3&F&8&4&F&Ct&x&5&1&9&6&F&Ce&x&6&4&A&9&F&Cr &x&8&8&C&E&F&DP&x&9&B&E&0&F&DV&x&A&D&F&3&F&DP"
set line 6 of player's scoreboard to "&8 "
set line 7 of player's scoreboard to "&7IP: BetterGPVP.minehut.gg"
set line 5 of player's scoreboard to "&7Hearts: &4%{maxhp::%player's uuid%}%&r&f/&r&4%{liquidatedHearts::%uuid of player%}%"
set line 4 of player's scoreboard to "&fCoins: &e%{points::%player's uuid%}%"
set line 3 of player's scoreboard to "&fKills: %{kills::%player's uuid%}%"
set line 2 of player's scoreboard to "&fDeaths: %{deaths::%player's uuid%}%"
set line 1 of player's scoreboard to "&b%player%"
wait 1 second
on death:
wait 1 tick
if victim is a player:
if attacker is a player:
give 1 sunflower named "&x&F&4&B&3&1&0K&x&F&1&A&7&1&0i&x&E&D&9&A&1&0l&x&E&9&8&D&1&0l&x&E&5&8&0&0&Fe&x&E&1&7&4&0&Fr&x&D&D&6&7&0&F &x&D&A&5&A&0&FT&x&D&6&4&D&0&Eo&x&D&2&4&1&0&Ek&x&C&E&3&4&0&Ee&x&C&A&2&7&0&En" to attacker
add 1 to {kills::%attacker's uuid%}
add 1 to {deaths::%victim's uuid%}
#add {bounty::%victim’s uuid%} to {bounty::%attacker’s uuid%}
add {bounty::%victim's uuid%} * -1 to {bounty::%victim's uuid%}
on death:
if victim is a player:
if attacker is a player:
if {kills::%attacker's uuid%} is greater than 50:
add 1 to {_bounty}
send "&8&lYou have gained 1 bounty" to attacker
if {_bounty} is greater than 200:
send "&8&lYou Have Become An Outcast" to attacker
on damage:
victim is goat
attacker is a player:
add 1 to attacker's level
on level change:
if player's level is greater than 0:
set {points::%player's uuid%} to player's level
on death:
if victim is a player:
add 1 to {kills::%attacker's uuid%}
add 1 to {deaths::%victim's uuid%}
command /ScoreboardReset:
permission: score.reset
aliases: sbr
trigger:
add -1 * {points::%player's uuid%} to player's level
set {points::%player's uuid%} to 0
set {deaths::%player's uuid%} to 0
set {kills::%player's uuid%} to 0
send "&6Reset Scorebord"
# On death of a player: Attacker gains max health and hearts, victim loses max health
on death of a player:
attacker is a player
set {_victim} to victim
set {_killer} to attacker
# Initialize default max health and hearts if not set
if {maxhp::%uuid of {_victim}%} is not set:
set {maxhp.%uuid of {_victim}%} to 10
if {maxhp::%uuid of {_killer}%} is not set:
set {maxhp.%uuid of {_killer}%} to 10
# Initialize hearts if not set
if {hearts::%uuid of {_victim}%} is not set:
set {hearts::%uuid of {_victim}%} to 10
if {hearts::%uuid of {_killer}%} is not set:
set {hearts::%uuid of {_killer}%} to 10
# Adjust health values
subtract 1 from {maxhp::%uuid of {_victim}%} # Victim loses max health
add 1 to {maxhp::%uuid of {_killer}%} # Killer gains max health
add 1 to {hearts::%uuid of {_killer}%} # Killer gains 1 heart
# Prevent victim going below 1 max HP
if {maxhp::%uuid of {_victim}%} < 1:
set {maxhp::%uuid of {_victim}%} to 1
# Apply max health changes
set {_killer}'s max health to {maxhp::%uuid of {_killer}%}
set {_victim}'s max health to {maxhp::%uuid of {_victim}%}
# Notify players about the changes
send "&cYou lost 1 max heart!" to {_victim}
send "&aYou gained 1 max heart and 1 heart as a reward!" to {_killer}
# On player join: Make sure player’s max HP and hearts are set correctly
on join:
if {maxhp::%uuid of player%} is set:
set player's max health to {maxhp::%uuid of player%}
else:
set {maxhp::%uuid of player%} to 10
set player's max health to 10
set {liquidatedHearts::%uuid of player%} to 0
if {hearts::%uuid of player%} is not set:
set {hearts::%uuid of player%} to 10 # Default starting hearts for the player
command /storehearts <number>:
trigger:
if arg-1 >= 1:
if {hearts::%uuid of player%} >= arg-1:
remove arg-1 from {hearts::%uuid of player%}
add arg-1 to {liquidatedHearts::%uuid of player%}
send "&aAdded %arg-1% hearts to purse. Total: %{liquidatedHearts::%uuid of player%}%" to player
else:
send "&cYou don't have that many hearts!" to player
else:
send "&cPlease enter a number greater than 0." to player
set players's max health to {maxhp::%uuid of player%}
command addhearts <number>:
aliases: givehearts, gh
permission: lifeSteal.addHearts
trigger:
if {hearts::%uuid of player%} is not set:
set {hearts::%uuid of player%} to 10
add arg-1 to {hearts::%uuid of player%}
send "Added %arg-1% hearts to %player%" to player
set players's max health to {maxhp::%uuid of player%}
command heartshop:
trigger:
open chest inventory with 3 rows named "&fPotion Effect Shop" to player
wait 1 tick
set slot 0 of player's current inventory to diamond named "&fSpeed Effect" with lore "", "&7Price: &a5 hearts", "" and "&a&lBuy"
set slot 1 of player's current inventory to emerald named "&fRegeneration Effect" with lore "", "&7Price: &a6 hearts", "" and "&a&lBuy"
set slot 2 of player's current inventory to redstone dust named "&fStrength Effect" with lore "", "&7Price: &a8 hearts", "" and "&a&lBuy"
set slot 3 of player's current inventory to iron ingot named "&fJump Boost Effect" with lore "", "&7Price: &a4 hearts", "" and "&a&lBuy"
on inventory click:
if name of event-inventory is "&fPotion Effect Shop":
cancel event
# Speed Effect
if event-item is diamond:
if {liquidatedHearts::%uuid of player%} >= 5:
remove 5 from {liquidatedHearts::%uuid of player%}
apply speed 1 to player for 60 seconds
send "&aYou bought the Speed Effect!" to player
else:
send "&cYou don't have enough hearts for this effect!" to player
# Regeneration Effect
else if event-item is emerald:
if {liquidatedHearts::%uuid of player%} >= 6:
remove 6 from {liquidatedHearts::%uuid of player%}
apply regeneration 1 to player for 60 seconds
send "&aYou bought the Regeneration Effect!" to player
else:
send "&cYou don't have enough hearts for this effect!" to player
# Strength Effect
else if event-item is redstone dust:
if {liquidatedHearts::%uuid of player%} >= 8:
remove 8 from {liquidatedHearts::%uuid of player%}
apply strength 1 to player for 60 seconds
send "&aYou bought the Strength Effect!" to player
else:
send "&cYou don't have enough hearts for this effect!" to player
# Jump Boost Effect
else if event-item is iron ingot:
if {liquidatedHearts::%uuid of player%} >= 4:
remove 4 from {liquidatedHearts::%uuid of player%}
apply jump boost 1 to player for 60 seconds
send "&aYou bought the Jump Boost Effect!" to player
else:
send "&cYou don't have enough hearts for this effect!" to player
every 5 seconds:
loop all players:
set players's max health to {maxhp::%uuid of loop-player%}
# Command to check player's current hearts
command /checkHearts:
trigger:
send "You currently have %{hearts::%uuid of player%}% hearts!" to player