Jump to content

Enchanting items with random enchantments not working!


DonGiovanni

Recommended Posts

Hello, I have recently been having problems with enchanting items in skript. Any help would be appreciated! 


technical details:

(I have included versions of skript and the addons I’m using here)

Plugins in use:

  • bStats
  • multiverse Core 
  • player server
  • plugin metrics
  • skellet (skript addon) V1.95a-minehut
  • skript v2.5-beta2-MH
  • skquery (skript addon) v3.6.4MH

Now for the issue! The scope of my script is to add a sword with a random enchantment in a chest. I used this as a stand-alone script to test features for a Skywars loot generator. 
Both scripts are correctly parsed, although 1 is not enchanting the sword.

 

1st Skript (without randomised enchantment)

command /go:
 set {item} to stone sword
 enchant {item} with sharpness 5
 add {item} to inventory of block at location at (0, 0, 0)

2nd Skript (the one that I want to do with randomised enchantments which isn’t working for me)

command /go:
 trigger:
  clear {listofenchantments::*}
  add looting and sharpness and smite to {listofenchantments::*}
  set {enchantment} to random element of {listofenchantments::*}
  set {enchantmentlevel} to random integer between 1 and 2
  set {item} to stone sword
  set {enchantmentandlevel} to "%{enchantment}% %{level}%"
  enchant {item} with {enchantmentandlevel}
  add {item} to inventory of block at location at (0, 0, 0)

when I send the {enchantmentandlevel} variable to the executer of the command it tells me the variable is “Looting 1” or “Sharpness 3” etc, but it simply places the item in the chest without enchanting.

Thank you for any responces!

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

Try doing 

set {enchantmentandlevel} to ("%{enchantment}% %{level}%" parsed as enchantment type)

Edited by _Tarna_
  • Thanks 1

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

---------------------------------------------------------

[VIP] - 7/27/2020

Community Support - 7/8/20 - 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - 12/20/22

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.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...