How to make a custom fortune

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

W00lyP4rr0t2

New Member
Feb 19, 2024
6
0
1
Hey there I was attempting to make some custom fortune for my box server as it uses a skript to automatically pick up items. I tried creating a fake enchantment with lore called Nether Fortune I but I cannot figure out how to make the skript. Here is what I have:

on mine:
if event-block is bone block:
if player's tool's lore contains "&fNether &2Fortune &6I":
cancel event
give player 2 bone
set event-block to air
if player's tool's lore does not contain "&fNether &2Fortune &6I"::
cancel event
give player bone
set event-block to air


Any help?
 
On the minecraft forum you can see that the average drop rate for fortune is this:
487675a6c20b9b3933c2d248c914e8fa4da7abdd

(https://minecraft.fandom.com/wiki/Fortune)

so for fortune one that would be 1/3 + 1/1 so about 1.33
the max is 2 and increses with every fortune level so the max for fortune 2 would be 3
I would just random gen the rest of the number so you could get 2

With all these changes the code would look like this:

code_language.skript:
on mine:
    if event-block is bone block:
        if player's tool's lore contains "&fNether &2Fortune &6I":
            cancel drops
            set {_drops} to rounded 1.33 + random number between 0 and 0.67
            give player {_drops} of bone
        if player's tool's lore does not contain "&fNether &2Fortune &6I":
            cancel drops
            give player bone

I also cleaned up the code a bit as you dont really need to cancel the event then remove the block. You can just cancel the drops. While there are some more improvments you can do I think this should do it!

Hope this helps
 
On the minecraft forum you can see that the average drop rate for fortune is this:
487675a6c20b9b3933c2d248c914e8fa4da7abdd

(https://minecraft.fandom.com/wiki/Fortune)

so for fortune one that would be 1/3 + 1/1 so about 1.33
the max is 2 and increses with every fortune level so the max for fortune 2 would be 3
I would just random gen the rest of the number so you could get 2

With all these changes the code would look like this:

code_language.skript:
on mine:
    if event-block is bone block:
        if player's tool's lore contains "&fNether &2Fortune &6I":
            cancel drops
            set {_drops} to rounded 1.33 + random number between 0 and 0.67
            give player {_drops} of bone
        if player's tool's lore does not contain "&fNether &2Fortune &6I":
            cancel drops
            give player bone

I also cleaned up the code a bit as you dont really need to cancel the event then remove the block. You can just cancel the drops. While there are some more improvments you can do I think this should do it!

Hope this helps
Thanks so much bro. Gonna try that out now