Solved Fortune Custom Drops

  • 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!

  • 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.

Jerooski

Member
Apr 19, 2020
16
0
0
25
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:
on break of obsidian:
    if player is holding diamond pickaxe:
        if player's held item is enchanted with fortune 1:
            cancel event
            set block to air
            give player 2 nether star
        else if player's held item is enchanted with fortune 2:
            cancel event
            set block to air
            give player 4 nether star
        else if player's held item is enchanted with fortune 3:
            cancel event
            set block to air
            give player 6 nether star
        else if player's held item is enchanted with fortune 4:
            cancel event
            set block to air
            give player 8 nether star
    else:
        cancel event
        set block to air
        give player nether star
 
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:
on break of obsidian:
    if player is holding diamond pickaxe:
        if player's held item is enchanted with fortune 1:
            cancel event
            set block to air
            give player 2 nether star
        else if player's held item is enchanted with fortune 2:
            cancel event
            set block to air
            give player 4 nether star
        else if player's held item is enchanted with fortune 3:
            cancel event
            set block to air
            give player 6 nether star
        else if player's held item is enchanted with fortune 4:
            cancel event
            set block to air
            give player 8 nether star
    else:
        cancel event
        set block to air
        give player nether star

this should work and it's way better:
Code:
on break of obsidian:
    cancel event
    if player's tool is a diamond pickaxe:
            set event-block to air
            give player (2 * (level of fortune of player's tool)) of nether star

    else:
        set event-block to air
        give player a nether star
Note: when using else if statment put the more specific conditions at the first.
 
  • Like
Reactions: Jerooski
this should work and it's way better:
Code:
on break of obsidian:
    cancel event
    if player's tool is a diamond pickaxe:
            set event-block to air
            give player (2 * (level of fortune of player's tool)) of nether star

    else:
        set event-block to air
        give player a nether star
Note: when using else if statment put the more specific conditions at the first.
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
 
Status
Not open for further replies.