#How to randomly enchant crafted tools?

1 messages · Page 1 of 1 (latest)

oblique meteor
#

I want to make a script that'll add random qualities to crafted tools and armor, but I've been struggling on how to reliably change crafted items and tools. I'd like to start with simply enchanting the crafted item. I do not want players to be able to reroll the item, so I'd like to add the item's quality once it enters their inventory, but I want to keep it optimized.

vague dawn
#

you can try on inventory slot change:, maybe set a variable for the player on craft:, then check that in the inventory change event

oblique meteor
#

Would that be optimized with ~20 players on the server?

#

The server'll only have 4gb of ram and wouldn't be running on anything particularly powerful

vague dawn
#

such as ```on craft of diamond block:
set {-example::%player's UUID%} to event-item

on inventory slot change:
{-example::%player's UUID%} = event-item
set event-item to ...```

vague dawn
oblique meteor
#

How do I wait a tick?

#

Oh, lol, just wait a tick

#

It's promising, but how do I modify the nbt with SkBee? I can't figure it out

#
    if event-item is any tool:
        set string tag "display;Name" of nbt of event-item to "Test"```
#

Trying to do this

#

It compiles, but doesn't work

vocal sluice
#

You can just use [this lusk beta](#skript-help-2 message) and do:

function withRandomEnchantment(item: item) :: item:
  set {_enchantment} to random element of (enchantments where [{_item} can be enchanted with input])
  set {_level} to random integer from minimum enchantment level of {_enchantment} to maximum enchantment level of {_enchantment}
  set {_item}'s {_enchantment} level to {_level}
  return {_item}

on craft:
  set event-slot to withRandomEnchantment(event-item)```
oblique meteor
#

I see

#

What in particular is provided by lusk?

vocal sluice
#

Everything related to enchantments within the function

tiny quarry
#

++++++

vocal sluice
tiny quarry
#

Phone in pocket

#

Texting

#

On accident