I really need help

  • 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 comminuty!

    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!

unnoeul

Member
Jun 22, 2025
1
0
1
First of all, I am Korean, so I am using a translator and writing this with my limited knowledge of English. So please understand that my words may not sound natural.

I'm making a magic enhancement script.

/enhance scroll [success rate] [failure rate] [destruction rate]
Entering this information will give the player one enhancement scroll (the success/failure/destruction rates are listed in the legend). Right-click on the enhancement scroll, and open the GUI by opening the 1-column box called "Enhance Window". Put a pickaxe in the 4th slot, and click the enhance button in the 8th slot. If successful, it will grant +1 to either the durability or luck efficiency of the item.


Example) If you succeed in strengthening a pickaxe with durability 3, efficiency 2, and luck 3, you will get one of durability, efficiency, or luck. If durability is drawn, it will become a pickaxe with durability 4, efficiency 2, and luck 3.

If you fail, just return the pickaxe.
If it is destroyed, the pickaxe should disappear.
I made a script that makes the order book disappear from the player's inventory when using the order book, but the strengthening probability is complete, but the enchantment level does not increase when strengthening is successful, so I really need your help.


For reference, the enchantment only increases durability, efficiency, and luck, no other enchantments are needed. Here is the code I wrote:

==================================================================


command /강화주문서 [<number>] [<number>] [<number>]:
trigger:
if arg 1 is set:
if arg 2 is set:
if arg 3 is set:
give 1 of paper named "&6강화 주문서" with lore "&a성공 확률: %arg 1%%%" and "&e실패 확률: %arg 2%%%" and "&c파괴 확률: %arg 3%%%" to player
message "&a강화 주문서를 지급했습니다."
stop
message "&c사용법: /강화주문서 [성공확률] [실패확률] [파괴확률]"


on rightclick with paper:
if name of player's tool is "&6강화 주문서":
cancel event
set {강화.확률.%uuid of player%::*} to lore of player's tool
remove 1 of player's tool from player
open chest with 1 row named "&8&l강화창" to player
wait 1 tick
set slot 8 of player's current inventory to anvil named "&6강화하기" with lore "&e클릭 시 강화 시도" and "&7성공 시 무작위 인챈트가 +1 강화됩니다."

on inventory click:
if name of event-inventory is "&8&l강화창":
if clicked raw slot is 0:
cancel event
if clicked raw slot is 1:
cancel event
if clicked raw slot is 2:
cancel event
if clicked raw slot is 3:
cancel event
if clicked raw slot is 5:
cancel event
if clicked raw slot is 6:
cancel event
if clicked raw slot is 7:
cancel event

if clicked raw slot is 8:
cancel event
set {_tool} to slot 4 of event-inventory
if {_tool} is air:
message "&c강화할 곡괭이를 넣어주세요." to player
close player's inventory
stop

set {_lore::*} to lore of player's tool

set {_sucText} to uncolored {_lore::1}
replace all "성공 확률: " with "" in {_sucText}
replace all "%%" with "" in {_sucText}
set {_suc} to {_sucText} parsed as number

set {_failText} to uncolored {_lore::2}
replace all "실패 확률: " with "" in {_failText}
replace all "%%" with "" in {_failText}
set {_fail} to {_failText} parsed as number

set {_destroyText} to uncolored {_lore::3}
replace all "파괴 확률: " with "" in {_destroyText}
replace all "%%" with "" in {_destroyText}
set {_destroy} to {_destroyText} parsed as number

set {_rand} to random integer between 1 and 100
if {_rand} is between 1 and {_suc}:
# 성공
set {_choice::*} to "unbreaking"
add "fortune" to {_choice::*}
add "efficiency" to {_choice::*}
set {_chosen} to random element out of {_choice::*}
set {_lvl} to enchant level of {_chosen} of {_tool}

message "%{_lvl}% %{_chosen}% %{_tool}%"




enchant {_tool} with "%{_chosen}% %{_lvl} + 1%" parsed as enchantment
message "&a강화 성공! &f%{_chosen}% 레벨이 &e%{_lvl}% → &e%{_lvl + 1}% &a로 증가했습니다."
set slot 4 of event-inventory to {_tool}
play sound "ENTITY_PLAYER_LEVELUP" with volume 1 and pitch 1 at player
launch flickering ball colored red and yellow and green at player's location timed 0.8
close player's inventory
stop

else if {_rand} is between {_suc} + 1 and {_fail}:
# 실패
message "&e강화 실패! 아이템은 그대로입니다."
set slot 4 of event-inventory to {_tool}
play sound "BLOCK_ANVIL_BREAK" with volume 1 and pitch 0.8 at player
close player's inventory
stop

else:
# 파괴
message "&c강화 실패! 아이템이 파괴되었습니다."
set slot 4 of event-inventory to air
play sound "ENTITY_ITEM_BREAK" with volume 1 and pitch 0.7 at player
launch flickering ball colored red and yellow and green at player's location timed 0.8
close player's inventory

on inventory close:
if name of event-inventory is "&8&l강화창":
set {_item} to slot 4 of event-inventory
if {_item} is not air:
give {_item} to player


on inventory close:
if name of event-inventory is "&8&l강화창":
set {_item} to slot 4 of event-inventory
if {_item} is not air:
give {_item} to player




on rightclick with paper:
set {_lore::*} to lore of player's tool

set {_sucText} to uncolored {_lore::1}
replace all "성공 확률: " with "" in {_sucText}
replace all "%%" with "" in {_sucText}
set {_suc} to {_sucText} parsed as number

set {_failText} to uncolored {_lore::2}
replace all "실패 확률: " with "" in {_failText}
replace all "%%" with "" in {_failText}
set {_fail} to {_failText} parsed as number

set {_destroyText} to uncolored {_lore::3}
replace all "파괴 확률: " with "" in {_destroyText}
replace all "%%" with "" in {_destroyText}
set {_destroy} to {_destroyText} parsed as number

message "&a성공: %{_suc}%%%, 실패: %{_fail}%%%, 파괴: %{_destroy}%%%" to player



my skript version 2.8.6

my minecraft version 1.2p
 

Attachments

  • 주문서.txt
    4.6 KB · Views: 39