Solved having problem giving random enchantment level

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Cander

Member
May 31, 2020
2
0
1
set {_sharpness} to random integer between 0 and 5
set {_enc1} to "sharpness" parsed as enchantment
give player wooden sword with enchantment "%{_enc1}% %{_sharpness}%" parsed as enchantment type
this won't work help me please

error
Line 13: (random weapon.sk)
[11:56:01] [Server thread/INFO]: 'wooden sword with enchantment "%{_enc1}% %{_sharpness}%" parsed as enchantment type' can't be added to a player because the former is neither an item type, an inventory nor an experience point
[11:56:01] [Server thread/INFO]: Line: give player wooden sword with enchantment "%{_enc1}% %{_sharpness}%" parsed as enchantment type

skript version: Skript-2.7.0-beta3
no addons
 
set {_sharpness} to random integer between 0 and 5
set {_enc1} to "sharpness" parsed as enchantment
give player wooden sword with enchantment "%{_enc1}% %{_sharpness}%" parsed as enchantment type
this won't work help me please

error
Line 13: (random weapon.sk)
[11:56:01] [Server thread/INFO]: 'wooden sword with enchantment "%{_enc1}% %{_sharpness}%" parsed as enchantment type' can't be added to a player because the former is neither an item type, an inventory nor an experience point
[11:56:01] [Server thread/INFO]: Line: give player wooden sword with enchantment "%{_enc1}% %{_sharpness}%" parsed as enchantment type

skript version: Skript-2.7.0-beta3
no addons

Hello Cander try something like this:
Code:
set {_enchant} to "sharpness"
set {_level} to random integer between 0 and 5
set {_item} to sword
enchant {_item} with "%{_enchant}% %{_level}%" parsed as enchantment type
give player {_item}
 
  • Like
Reactions: Cander
Hello Cander try something like this:
Code:
set {_enchant} to "sharpness"
set {_level} to random integer between 0 and 5
set {_item} to sword
enchant {_item} with "%{_enchant}% %{_level}%" parsed as enchantment type
give player {_item}
Thank you so much. It works really well.
 
Status
Not open for further replies.