I call my skript "maxHealth" and it's for editing health values of players and giving them a reason to not die. I had experimented with the idea of making it where players lost max hp on death until a minimum of six hearts like...
and {minimumHealth} would be a variable with a default value of 6, yada yada yada.
That's simply backstory because I realized that my server wasn't meant to be hardcore, but rather a by-invite enhanced vanilla SMP. Basically PaperMC with plugins that add vanilla like mechanics(enchantments, crop harvesting, and now this for Health). In light of this, I decided to instead make it to where players could gain hearts by completing certain tasks.
So, here's the concept, you start out with a certain amount of {defaultHealth} and through completing certain challenges, you can gain more and increase your {maxHealth}. Here's the thing. When you die, you reset back to {defaultHealth} but upon using a totem of undying(RMB in your main hand) it activates(by running the kill effect) and gives you your {maxHealth} back! Anyway, here's the reason I'm making this thread, because the system that I just described works perfectly.... So, what do I make those challenges?
TL;DR
I made a skript that lets people go above health cap, what do I make the challenges to reward hearts?
Also please explain if you have an idea because I just started Skript today.
Code:
on death:
if player's max health is greater than {minimumHealth}:
set player's max health to player's max health - 1
and {minimumHealth} would be a variable with a default value of 6, yada yada yada.
That's simply backstory because I realized that my server wasn't meant to be hardcore, but rather a by-invite enhanced vanilla SMP. Basically PaperMC with plugins that add vanilla like mechanics(enchantments, crop harvesting, and now this for Health). In light of this, I decided to instead make it to where players could gain hearts by completing certain tasks.
So, here's the concept, you start out with a certain amount of {defaultHealth} and through completing certain challenges, you can gain more and increase your {maxHealth}. Here's the thing. When you die, you reset back to {defaultHealth} but upon using a totem of undying(RMB in your main hand) it activates(by running the kill effect) and gives you your {maxHealth} back! Anyway, here's the reason I'm making this thread, because the system that I just described works perfectly.... So, what do I make those challenges?
TL;DR
I made a skript that lets people go above health cap, what do I make the challenges to reward hearts?
Also please explain if you have an idea because I just started Skript today.
Code:
#----------MAX HEALTH ADDON----------
#----------DEFAULT HEALTH VALUE----------
variables:
{defaultHealth} = 10
#----------JOIN EVENTS----------
#sets new players to the default health
on first join:
set max health of player to {defaultHealth}
{maxHealth::%player%} = {defaultHealth}
#sets existing players max health
on join:
if {maxHealth::%player%} is not set:
set {maxHealth::%player%} to {defaultHealth}
#----------COMMANDS----------
command /dh:
description: Displays the current default health value.
trigger:
send "The current default health is %{defaultHealth}%" to player
command /dhset [<number=10>]:
description: Sets the default health for when new players join the server
permission: maxhealth.defaulthealth.set
permission message: You cannot use this command.
trigger:
set {defaultHealth} to arg number
send "The current default health is now %{defaultHealth}%."
command /mh:
description: Displays your current obtainable max health value.
trigger:
if {maxHealth::%player%} is not set:
set {maxHealth::%player%} to {defaultHealth}
send "Your current obtainable max health is %{maxHealth::%player%}%." to player
command /mhset <player> [<number=10>]:
description: Sets the max obtainable health of inputed player.
permission: maxhealth.maxhealth.set
permission message: You cannot use this command.
trigger:
set {maxHealth::%player%} to arg number
send "%arg 1%'s max obtainable health was set to %arg 2%."
command /mhtestset <player> [<number=10>]:
description: Sets the max health of inputed player.
permission: maxhealth.maxhealth.set
permission message: You cannot use this command.
trigger:
set arg player's max health to arg number
send "%arg 1%'s max health was set to %arg 2%."
#----------RECOVER MAX HEALTH----------
on right click:
if player is holding a totem of undying in main hand:
if {maxHealth::%player%} is not set:
set {maxHealth::player} to {defaultHealth}
send "No max health value found, setting max health to 10." to player
if player's max health is equal to {maxHealth::%player%}:
send "You already have your max obtainable health."
if player's max health is not equal to {maxHealth::%player%}:
kill player
set player's max health to {maxHealth::%player%}
send "You have recovered your lost hearts!" to player
#----------RESET OBTAINED HEALTH ON DEATH----------
on death:
set player's max health to {defaultHealth}
Last edited: