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.
#How to randomly enchant crafted tools?
1 messages · Page 1 of 1 (latest)
you can try on inventory slot change:, maybe set a variable for the player on craft:, then check that in the inventory change event
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
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 ...```
shouldnt need NASA tech
there's probably a
required before changing (or maybe even checking) the item
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
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)```
Everything related to enchantments within the function
++++++
what is the definition of this