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 Fortune Custom Drops

Discussion in 'Skript' started by Jerooski, Apr 28, 2020.

Thread Status:
Not open for further replies.
  1. Jerooski

    Jerooski Member

    Joined:
    Apr 19, 2020
    Messages:
    16
    Likes Received:
    0
    I want players to break obsidian and get a nether star and that it goes straight into the inventory without dropping. so far that works and so does the fortune 1 enchantment. But when I use fortune 2 or 3 it acts as if I was using fortune 1, giving me 2 nether star. How can I make it so the other fortune levels work

    Code (Text):
    1.  
    2. on break of obsidian:
    3.     if player is holding diamond pickaxe:
    4.         if player's held item is enchanted with fortune 1:
    5.             cancel event
    6.             set block to air
    7.             give player 2 nether star
    8.         else if player's held item is enchanted with fortune 2:
    9.             cancel event
    10.             set block to air
    11.             give player 4 nether star
    12.         else if player's held item is enchanted with fortune 3:
    13.             cancel event
    14.             set block to air
    15.             give player 6 nether star
    16.         else if player's held item is enchanted with fortune 4:
    17.             cancel event
    18.             set block to air
    19.             give player 8 nether star
    20.     else:
    21.         cancel event
    22.         set block to air
    23.         give player nether star


     
  2. Best Answer:
    Post #3 by Runakai, Apr 28, 2020
  3. Abdera7mane

    Abdera7mane Active Member

    Joined:
    Aug 18, 2019
    Messages:
    56
    Likes Received:
    7
    this should work and it's way better:
    Code (Text):
    1.  
    2. on break of obsidian:
    3.     cancel event
    4.     if player's tool is a diamond pickaxe:
    5.             set event-block to air
    6.             give player (2 * (level of fortune of player's tool)) of nether star
    7.  
    8.     else:
    9.         set event-block to air
    10.         give player a nether star
    11.  
    Note: when using else if statment put the more specific conditions at the first.
     
    • Like Like x 1
  4. Runakai

    Moderator Supporter

    Joined:
    Apr 27, 2018
    Messages:
    497
    Likes Received:
    31
    You should be able to just clear the drops so you don't have to cancel the event and set it to air. Less code and looks better
     
    • Agree Agree x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...