MetaData issues...

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

Status
Not open for further replies.

4IDp8

Member
Dec 15, 2020
12
0
1
26
I am new to skript, but i wanted to add custom enchants to my server,

The only problem is that my code dont work, here it is:


on skript load:
register a new custom enchantment with id name "Speed"
set {_speedenchant} to "Speed" parsed as custom enchantment
set max level of {_speedenchant} to 2
set rarity of {_speedenchant} to 2
set accepted items for {_speedenchant} to "boots"
set lore name of {_speedenchant} to "Gives you speed!"

on armor equip:
if lore of item contains "speed":
set metadata value "custom-enchantment-speed" of player to 1

while metadata value "custom-enchantment-speed" of player is 1:
every second:
broadcast s
 
You don't have to assign custom metadata to players. You can just check if their boots are your custom enchanted boots:
Code:
on armor equip:
    while lore of boots of player contains "speed":
        broadcast "s"
        wait 1 seconds
 
  • Like
Reactions: 4IDp8
If you are trying to solve some problem, you have to first think of how it could be implemented.

For example:
I want boots which will create random colored wool trail behind me as I walk...
1. I need to create walk event handler.
2. I need to check block under me (don't want it to create trail in air or water...).
3. I need to replace that block with random colored wool.

Since your problem is fairly simple (Minecraft has already implement speed logic), you just have to apply speed effect when player equip boots and as soon as player take the boots off you have to remove the effect.

This is your implementation:
Code:
on armor equip:
    if lore of boots of player contains "speed":
        apply speed 2 to the player for 100000 seconds
        
sharpsk on armor unequip:
    if lore of boots of player does not contain "speed":
        remove speed from player

Note: Take it as a pseudo code, I didn't tested it.
 
I ment, how do i apply the speed enchant to boots, and how to i make it appear in an enchantment table?

The code dont work btw, i get no speed when i put my boots on (The capitalation is right)
 
how to i make it appear in an enchantment table?
Add this line to your init section:
Code:
set enabled for {_speedenchant} to true

The code dont work btw, i get no speed when i put my boots on (The capitalation is right)
You probably need some other condition there. Use this syntax:
Code:
%itemtype% has custom enchantment %custom enchantment%
If you won't get it to work, then try some debugging.
 
SD1nEY4
https://imgur.com/a/SD1nEY4
[doublepost=1608292601,1608234793][/doublepost]@MusicManSK Something is wrong, check the imgur link
 
Status
Not open for further replies.