Jump to content

Why is my Fortune skript not working?


EdTheWizard

Recommended Posts

Ok so here it is:
on block break:
    if player's tool is enchanted with fortune 1:
        set {_block} to type of block
        if lore of player's held item contains "&7Telepathy 1":
            clear drops
            give player 2 of {_block}
        else:
            drop 2 of {_block}
    else if player's tool is enchanted with fortune 2:
        set {_block} to type of block
        if lore of player's held item contains "&7Telepathy 1":
            clear drops
            give player 3 of {_block}
        else:
            drop 3 of {_block}
    else if player's tool is enchanted with fortune 3:
        set {_block} to type of block
        if lore of player's held item contains "&7Telepathy 1":
            clear drops
            give player 4 of {_block}
        else:
            drop 4 of {_block}
    else if player's tool is enchanted with fortune 4:
        set {_block} to type of block
        if lore of player's held item contains "&7Telepathy 1":
            clear drops
            give player 5 of {_block}
        else:
            drop 5 of {_block}
    else if player's tool is enchanted with fortune 5:
        set {_block} to type of block
        if lore of player's held item contains "&7Telepathy 1":
            clear drops
            give player 6 of {_block}
        else:
            drop 6 of {_block}
    else if player's tool is enchanted with fortune 6:
        set {_block} to type of block
        if lore of player's held item contains "&7Telepathy 1":
            clear drops
            give player 7 of {_block}
        else:
            drop 7 of {_block}
    else if player's tool is enchanted with fortune 7:
        set {_block} to type of block
        if lore of player's held item contains "&7Telepathy 1":
            clear drops
            give player 8 of {_block}
        else:
            drop 8 of {_block}
    else if player's tool is enchanted with fortune 8:
        set {_block} to type of block
        if lore of player's held item contains "&7Telepathy 1":
            clear drops
            give player 9 of {_block}
        else:
            drop 9 of {_block}
    else if player's tool is enchanted with fortune 9:
        set {_block} to type of block
        if lore of player's held item contains "&7Telepathy 1":
            clear drops
            give player 10 of {_block}
        else:
            drop 10 of {_block}
    else if player's tool is enchanted with fortune 10:
        set {_block} to type of block
        if lore of player's held item contains "&7Telepathy 1":
            clear drops
            give player 11 of {_block}
        else:
            drop 11 of {_block}


THERE IS NO BUGS IN /Skript reload scripts
but when I use something with fortune no matter what enchants I give or if it has telepathy or not it always drops or gives me 3 blocks

 

plz help

Link to comment
Share on other sites

Posted (edited)

i asked chatgpt to make it better and I have no way to check if this works because I hit the daily time limit of my server so can someone tell me if this would work?on block break:
    set {_tool} to player's tool
    set {_telepathy} to false
    set {_fortuneLevel} to 0
    
    loop lore of {_tool} as {_line}:
        if {_line} contains "&7Telepathy 1":
            set {_telepathy} to true
        if {_line} starts with "&7Fortune ":
            set {_fortuneLevel} to last word of {_line}
    
    if {_telepathy} is true:
        clear drops
        give player {_fortuneLevel + 1} of type of block
    else:
        drop {_fortuneLevel + 1} of type of block

 

 

 

Edited by EdTheWizard
Link to comment
Share on other sites

Ok i got it, its lore-based so it can look nice too!
 

on block break: #Fortune and Telepathy
    set {_telepathy} to false
    set {_fortuneLevel} to 0 

    loop lore of player's held item:
        set {_line} to loop-value
        if {_line} contains "&7⮞ &eTelepathy 1":
            set {_telepathy} to true
        if {_line} contains "&7⮞ &eFortune ":
            set {_list::*} to split {_line} by " "
            set {_fortuneIndex} to index of "&7⮞ &eFortune " in {_line}
            set {_secondItem} to {_list::%{_fortuneIndex} + 2%}
    set {_fortuneLevel} to {_secondItem}
    if {_telepathy} is true:
        clear drops
        give player ({_fortuneLevel} parsed as number) of type of block
        give player 1 of type of block
    else:
        drop ({_fortuneLevel} parsed as number) of type of block

If you want to know what it looks like
image.png.8a285980c051a323c2f1d6d9259a1dde.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...