1. 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 comminuty!

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

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Variable not changing but hearts are

Discussion in 'Skript' started by ArchLinux42, May 23, 2022.

Tags:
Thread Status:
Not open for further replies.
  1. ArchLinux42

    ArchLinux42 Member

    Joined:
    May 23, 2022
    Messages:
    1
    Likes Received:
    0
    I'm new to skripting and I am having a little trouble. The variable doesn't seem to change but it gives hearts over the maximum.


    Code (Text):
    1. on join:
    2.     if {joins::*} does not contain player's uuid:
    3.         add player's uuid to {joins::*}
    4.         set {health::%uuid of player%} to 10
    5. on death of player:
    6.     if attacker is a player:
    7.         if maximum health of attacker <= 200:
    8.             if maximum health of victim >= 1:
    9.                 add 1 to {health::%uuid of attacker%}
    10.                 set the maximum health of attacker to {health::%uuid of attacker%}
    11.                 execute console command "/heal %attacker%"
    12.                 subtract 1 from {health::%uuid of victim%}
    13.                 set the maximum health of victim to {health::%uuid of victim%}
    14.             else:
    15.                 send "You cant gain hearts from this player"
    16.                 stop
    17. command /sethearts [<offline player>] [<number>]:
    18.     permission: skript.sethearts
    19.     trigger:
    20.         set {health::%uuid of arg-1%} to arg-2
    21.         set the maximum health of arg-1 to {health::%uuid of arg-1%}
    22.         message "&6Set %arg-1%'s hearts to %arg-2%"
    23. command /resethearts [<offline player>]:
    24.     permission: skript.resethearts
    25.     trigger:
    26.         set {health::%uuid of arg-1%} to 10
    27.         set the maximum health of arg-1 to 10
    28.         message "&6Reset %arg-1%'s hearts"
    29. command /hearts [<offline player>]:
    30.     permission: skript.hearts
    31.     trigger:
    32.         message "&6%arg-1% has %{health::%uuid of arg-1%}% hearts"
     
Thread Status:
Not open for further replies.

Share This Page

Loading...