How do i make it so if u have a certain level u get a heart if u lose levels you lose the heart

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Kamigearz

Member
Apr 10, 2022
3
0
1
  • This is the skript i have so far the message thing also does not work
command /level:
trigger:
if player's level is greater than or equal to 10:
add 1 to max health of player
Wait 2 ticks
if the level of player <= 9 and below:
command /resetlevel:
trigger:
subtract 1 from max health of player
Wait 2 ticks
if the max health of player <= 11 and above:
if the max health of player <= 10 and below:
set player's max health 10:
send "&bYou cant go past this point otherwise u will have low hearts" to player
 
Last edited:
This is the skript i have so far the message thing also does not work
Code (Text):
command /level:
trigger:
if player's level is greater than or equal to 10:
add 1 to max health of player
Wait 2 ticks
if the level of player <= 9 and below:
command /resetlevel:
trigger:
subtract 1 from max health of player
Wait 2 ticks
if the max health of player <= 11 and above:
if the max health of player <= 10 and below:
set player's max health 10:
send "&bYou cant go past this point otherwise u will have low hearts" to player
Do you want 1 extra heart every 10 levels ?
[doublepost=1649594610,1649591852][/doublepost]
This is the skript i have so far the message thing also does not work
Code (Text):
command /level:
trigger:
if player's level is greater than or equal to 10:
add 1 to max health of player
Wait 2 ticks
if the level of player <= 9 and below:
command /resetlevel:
trigger:
subtract 1 from max health of player
Wait 2 ticks
if the max health of player <= 11 and above:
if the max health of player <= 10 and below:
set player's max health 10:
send "&bYou cant go past this point otherwise u will have low hearts" to player
I test this and is working and you dont need commands, also remove the hearts if you loose experience like enchanting or die. x3 is the maximum level need to get the maximum ammount of hearts.
Code:
function sethearts(p: player):
    set {_level} to level of {_p}
    if {_level} is more than or equal to 10:#change this if you want to 10 is the minumum level needed. if you change this also change x1 to the same value
        if {_level} is not more than or equal to 60:#if you change this change x3 to the same value
            #calculate the ammount of hearts
            set {_x1} to 10#the minimum level amount
            set {_x3} to 60#the maximun level
            set {_y1} to 10#minumum heart ammount
            set {_y3} to 20#maximum heart ammount when x3 is at 60
            set {_calculate1} to ({_level} - {_x1})
            set {_calculate2} to ({_y3} - {_y1})
            set {_calculate3} to ({_calculate1} * {_calculate2})
            set {_calculate4} to ({_x3} - {_x1})
            set {_calculate5} to ({_calculate3} / {_calculate4})
            set {_y2} to ({_calculate5} + {_y1})
            set the maximum health of {_p} to {_y2}
            message "%{_y2}%" to {_p} #send a message to the player y2 is the new ammount of hearts
        else:
            message "You have the maximum ammount of hearts" to {_p}
    else:
        set the maximum health of {_p} to 10


on player level up:
    sethearts(player)
on player level down:
    sethearts(player)
 
do u know how to add hearts at certain level e.x 10 levels = 1 + max health 20 is 1 + same as the ithers
 
Status
Not open for further replies.