#Fortune and auto pickup Skript help

1 messages · Page 1 of 1 (latest)

proven sonnet
#
  1. {BlockByPlayer::%event-location%} this is functional, however i dont recommend it as it will quickly clog up your variables.csv, especially if its say a part of a base that a player will never mine again.
  • the best alternative would be to use skbee and store it in the block's NBT.
#
  1. you don't need a condition for every level of fortune, theres an expression for that.
  • you can either give f + 1, or a random amount between 1 and f (where f = level of fortune)
  1. on a similar note, theres a whole lot of repetition there. you can make that much shorter
craggy oasis
#

Thank you so much!

#

One quick question though, what do you mean by store in block's NBT. If you don't mind.

#

And I'm kind of confused on the enchant thing, like what are you saying with the random amount between 1 and f. Sorry

proven sonnet
# craggy oasis One quick question though, what do you mean by store in block's NBT. If you don'...

NBT is what makes up the item, and makes it different from other items of the same itemtype.
(An item type is just the kind of item it is. So a diamond and a diamond enchanted with mending are both an itemtype of diamond)
NBT consists of tags, some common examples are the enchantments, lore, names, durability, etc. However, with skbee you can add your own custom tags to items, blocks, and entities. you could use one of those to check if a block was placed by a player

#

with the bonus of having it automatically deleted when a block is broken, unlike a variable

proven sonnet
craggy oasis
#

might as well leave it up to luck lol

proven sonnet
#

ex, in normal minecraft, a normal pickaxe will give 1 diamond, but a fortune 3 one will give anywhere between 1 and 4. you can do it like that, or always give 4

craggy oasis
#

yeah, thank you that makes a lot of sense now

craggy oasis
#
on block place:
    set {_blocknbt::*} to nbt tags of nbt compound of block

on block break:
    if {_blocknbt::*} is set:
        if player's tool is not enchanted with fortune:
            set {_drops::*} to drops of block with player's tool
            clear drops
            give player {_drops::*}
        else:
            set {_drops::*} to drops of block
            clear drops
            give player {_drops::*}
    else:
        if player's tool is enchanted with fortune:
            set {_drops::*} to drops of block
            clear drops
            give player %level of fortune% + 1 {_drops::*}
            send "%{_drops::*}%"```
#

This is what I have now

#

But when I try it I get an error

proven sonnet
#

you dont need the percents there.

#

and its level of fortune of player's tool i beleive

#

{_blocknbt::*} is local, so you cant use it across events either

#

i would juston place: set string tag "placedByAPlayer" of NBT compound of event-block to player's uuid

#

then you can check if there's that tag on break

craggy oasis
#
on block place:
    set string tag "placedByAPlayer" of compound of event-block to player's uuid

on block break:
    if block has tag "placedByAPlayer":
        if player's tool is not enchanted with fortune:
            set {_drops::*} to drops of block with player's tool
            clear drops
            give player {_drops::*}
        else:
            set {_drops::*} to drops of block
            clear drops
            give player {_drops::*}
    else:
        if player's tool is enchanted with fortune:
            set {_drops::*} to drops of block
            clear drops
            give player level of fortune + 1 {_drops::*}
            send "%{_drops::*}%"```
This is what I have now and these are the errors. I feel really useless. lol
proven sonnet
#

line 102 you forgot "nbt"

#

line 105 its nbt compound of x has tag y

craggy oasis
#

thank you

#

the only error i get now is with fortune..

proven sonnet
#

try (level of fortune of player's tool + 1) of {_drops::*}

#

if that doesnt work you can always loop (level of fortune of player's tool + 1) times

craggy oasis
#

Wdym wouldnt looping it just make it do the same thing?

#

The first one didnt work is why I was asking

craggy oasis
#

I know it has to do with the {_drops::*} part because of this

#

I have in the skript to send me what drops is on block mine and it just says cobblestone block but for some reason I get this error when it's set to drops but not when it's set to cobblestone block

proven sonnet
#

just loop that many times and give it i guess

craggy oasis
#

oh ok its gonna lag a lot but ill try again

proven sonnet
#

it shouldnt with the code you have..

craggy oasis
#

okay ill just try lol

#

wait

#

lol

#
on block place:
    set string tag "placedByAPlayer" of nbt compound of event-block to player's uuid

on block break:
    if nbt compound of event-block has tag "placedByAPlayer":
        if player's tool is not enchanted with fortune:
            set {_drops::*} to drops of block with player's tool
            clear drops
            give player {_drops::*}
        else:
            set {_drops::*} to drops of block
            clear drops
            give player {_drops::*}
    else:
        if player's tool is enchanted with fortune 1:
            set {_drops::*} to drops of block
            clear drops
            give player {_drops::*} and {_drops::*}
        else if player's tool is enchanted with fortune 2:
            set {_drops::*} to drops of block
            clear drops
            give player {_drops::*} and {_drops::*} and {_drops::*}
        else if player's tool is enchanted with fortune 3:
            set {_drops::*} to drops of block
            clear drops
            give player {_drops::*} and {_drops::*} and {_drops::*} and {_drops::*}
        else if player's tool is enchanted with fortune 4:
            set {_drops::*} to drops of block
            clear drops
            give player {_drops::*} and {_drops::*} and {_drops::*} and {_drops::*} and {_drops::*}

It's only giving me 2 blocks when I should be getting 4 because I have fortune 3

craggy oasis
proven sonnet
#

why do you still have the multiple conditions??