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.

Solved Get killer from crystal

Discussion in 'Skript' started by WhoCutTheCheese, Aug 11, 2022.

  1. WhoCutTheCheese

    Joined:
    Apr 22, 2020
    Messages:
    13
    Likes Received:
    1
    I'm trying to get the killer from crystal pvp
    Code (Skript):
    1.  
    2. on death of player:
    3.     victim is player
    4.     attacker is end crystal
    5.     add 1 to {kills::%metadata value "playerWhoDetonated" of attacker parsed as player%}
    6.     broadcast "&c%victim% &fwas BLOWN up by &c%metadata value "playerWhoDetonated" of attacker parsed as player%"
    7.  
    8. #And this is what sets the nbt data
    9. on damage:
    10.     if victim is end crystal:
    11.         set metadata value "playerWhoDetonated" of victim to damager
    12.  
    13.  
    14. #This is the error
    15. Can't compare entity with heal reason
    16.  
    I know why you can't do
    attacker is end crystal
    but I don't know how to do it now
     
  2. mordrowned

    mordrowned Member

    Joined:
    Apr 22, 2021
    Messages:
    40
    Likes Received:
    2
    Since end crystal is a heal reason, you can't use it as attacker BUT you CAN use attacker and end crystal as text
    Example: (should work hopefully)


    Code (Text):
    1. on death of player:
    2.     victim is player
    3.     "%attacker%" contains "ender crystal"
    4.     add 1 to {kills::%metadata value "playerWhoDetonated" of attacker parsed as player%}
    5.     broadcast "&c%victim% &fwas BLOWN up by &c%metadata value "playerWhoDetonated" of attacker parsed as player%"
    6.  
    7. #And this is what sets the nbt data
    8. on damage:
    9.     if "%victim%" contains "ender crystal":
    10.         set metadata value "playerWhoDetonated" of victim to damager
     
  3. WhoCutTheCheese

    Joined:
    Apr 22, 2020
    Messages:
    13
    Likes Received:
    1
    Thank you! This works, I didn't think of this.
     

Share This Page

Loading...