Solved Custom Enchantment Skript won't load

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

Brodzy

New Member
Sep 4, 2021
8
0
1
20
I've recently started running a server on my home PC as a trial before possibly transferring all the files onto a hosted server. I am in the middle of creating a custom enchantment skript, my first skript in forever, and it doesn't seem to load. I have tried reloading the plugin itself (using PlugMan), as well as the entire server. Running the /enchanter command results in the unknown command message.

I am using the much older version of Skript and therefore this is likely the reason, however I used this when I first started and also couldn't seem to find a download for the 2.6 version.

Any advice would be appreciated.

Thanks,

Brodzy <3

p.s. the file is a .sk file in the plugin folder
 
I don't see anything wrong with the txt, try to update skript
Hi Crocie. I have updated to the newest version and the /enchanter command can now be run, however many errors occur based on the spacing, yet whenever I change the spacing to the expected values, the expected value increases.
[doublepost=1630772335,1630770531][/doublepost]I seem to have gotten it working for the most part. Only issue is at the moment that you are able to click anywhere and essentially trade a diamond block for a random enchantment
 

Attachments

  • enchants.sk
    1.7 KB · Views: 122
  • Screenshot (4).png
    Screenshot (4).png
    124.1 KB · Views: 102
I don't understand the problem
The GUI opens properly and does its job of essentially trading a single diamond block for an enchanted book. However, the trade occurs no matter where in the GUI you click, I am aiming for it to only function if the nether star is clicked.
 
I've recently started running a server on my home PC as a trial before possibly transferring all the files onto a hosted server. I am in the middle of creating a custom enchantment skript, my first skript in forever, and it doesn't seem to load. I have tried reloading the plugin itself (using PlugMan), as well as the entire server. Running the /enchanter command results in the unknown command message.

I am using the much older version of Skript and therefore this is likely the reason, however I used this when I first started and also couldn't seem to find a download for the 2.6 version.

Any advice would be appreciated.

Thanks,

Brodzy <3

p.s. the file is a .sk file in the plugin folder
I'm not really sure but I think that you're using skript tuske, if so you should change to skript-gui and do this:

Code:
command /enchanter:
        permission: enchanter.use
        permission message: &cSomething broke...
        trigger:
                create gui with id "enchanter" with virtual chest inventory with 1 row named "&e&k&lAA&r &7&lENCHANTER &e&k&lAA&r":
                    make gui 2 with nether star with name "&eRandom Custom Enchantment" with lore "&7Costs &eDiamond Block&7!":
                        if player has a diamond block:
                            set {custom.enchant} to random integer between 1 and 5
                            if {custom.enchant} is 1:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Blindness"
                                set line 1 of lore of {_book} to "&7Chance to apply &eblindess effect &7on the enemy!"
                                set line 2 of lore of {_book} to "&eSword Enchantment"
                                give player {_book}
                            if {custom.enchant} is 2:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Speed"
                                set line 1 of lore of {_book} to "&7Applies &espeed effect &7to the user!"
                                set line 2 of lore of {_book} to "&eBoots Enchantment"
                                give player {_book}
                            if {custom.enchant} is 3:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Shock"
                                set line 1 of lore of {_book} to "&7Chance to &estrike lightning &7 on the enemy!"
                                set line 2 of lore of {_book} to "&eChestplate Enchantment"
                                give player {_book}
                            if {custom.enchant} is 4:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Afterlife"
                                set line 1 of lore of {_book} to "&7Restores one heart and applies &einvisibility effect &7to the user on death!"
                                set line 2 of lore of {_book} to "&eHelmet Enchantment"
                                give player {_book}
                            if {custom.enchant} is 5:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7PLACEHOLDER"
                                set line 1 of lore of {_book} to "PLACEHOLDER"
                                set line 2 of lore of {_book} to "PLACEHOLDER"
                                give player {_book}
                        close player's inventory
               show last gui to player                        
on damage:
#Blindess
        if lore of attacker's weapon contains "&7Blindness":
                chance of 10%:
                        apply blindess 1 to victim for 2 seconds
#Shock
        if lore of victim's chestplate contains "&7Shock":
                chance of 5%
                        apply nausea 1 to victim for 2 seconds
                        strike lightning effect at the attacker
                        damage attacker by 1 heart
 
#Afterlife
on death:
        if lore of victim's helmet contains "&7Afterlife":
                apply instant_health 1 to victim for 1 seconds
                apply invisibility 1 to victom for 5 seconds
           
every second:
        loop all players:
#Speed
                if lore of loop-player's boots contains "&7Speed":
                    apply speed 1 to loop-player for 1 seconds
I didn't test this so I don't know if it works or not but try it. (Uninstall skript-tuske and use skript-gui first, if you are using it because I don't remember how skript-tuske works as I used to use that but realized that it has too many bugs so changed to skript-gui)
Edit: I forgot something so I edited it, still not tested though.
 
Last edited:
I'm not really sure but I think that you're using skript tuske, if so you should change to skript-gui and do this:

Code:
command /enchanter:
        permission: enchanter.use
        permission message: &cSomething broke...
        trigger:
                create gui with id "enchanter" with virtual chest inventory with 1 row named "&e&k&lAA&r &7&lENCHANTER &e&k&lAA&r":
                    make gui 2 with nether star with name "&eRandom Custom Enchantment" with lore "&7Costs &eDiamond Block&7!":
                        if player has a diamond block:
                            set {custom.enchant} to random integer between 1 and 5
                            if {custom.enchant} is 1:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Blindness"
                                set line 1 of lore of {_book} to "&7Chance to apply &eblindess effect &7on the enemy!"
                                set line 2 of lore of {_book} to "&eSword Enchantment"
                                give player {_book}
                            if {custom.enchant} is 2:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Speed"
                                set line 1 of lore of {_book} to "&7Applies &espeed effect &7to the user!"
                                set line 2 of lore of {_book} to "&eBoots Enchantment"
                                give player {_book}
                            if {custom.enchant} is 3:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Shock"
                                set line 1 of lore of {_book} to "&7Chance to &estrike lightning &7 on the enemy!"
                                set line 2 of lore of {_book} to "&eChestplate Enchantment"
                                give player {_book}
                            if {custom.enchant} is 4:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Afterlife"
                                set line 1 of lore of {_book} to "&7Restores one heart and applies &einvisibility effect &7to the user on death!"
                                set line 2 of lore of {_book} to "&eHelmet Enchantment"
                                give player {_book}
                            if {custom.enchant} is 5:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7PLACEHOLDER"
                                set line 1 of lore of {_book} to "PLACEHOLDER"
                                set line 2 of lore of {_book} to "PLACEHOLDER"
                                give player {_book}
                        close player's inventory
               show last gui to player                       
on damage:
#Blindess
        if lore of attacker's weapon contains "&7Blindness":
                chance of 10%:
                        apply blindess 1 to victim for 2 seconds
#Shock
        if lore of victim's chestplate contains "&7Shock":
                chance of 5%
                        apply nausea 1 to victim for 2 seconds
                        strike lightning effect at the attacker
                        damage attacker by 1 heart
 
#Afterlife
on death:
        if lore of victim's helmet contains "&7Afterlife":
                apply instant_health 1 to victim for 1 seconds
                apply invisibility 1 to victom for 5 seconds
          
every second:
        loop all players:
#Speed
                if lore of loop-player's boots contains "&7Speed":
                    apply speed 1 to loop-player for 1 seconds
I didn't test this so I don't know if it works or not but try it. (Uninstall skript-tuske and use skript-gui first, if you are using it because I don't remember how skript-tuske works as I used to use that but realized that it has too many bugs so changed to skript-gui)
Edit: I forgot something so I edited it, still not tested though.

Thanks you for the advice, I actually had neither tuSKe nor GUI installed and have no installed both, might be a bad idea but I'll soon find out.
The code above didn't seem to make a different, but thank you for trying.
[doublepost=1630812414,1630812380][/doublepost]
Btw TuSKe has an own custom enchantment feature

Sorry, could you expand on that? Not sure what you mean exactly.
[doublepost=1630812790][/doublepost]The GUI seems to function nearly as expected, still have the issue of being able to interact with all slots instead of just the nether star but that isn't a major issue. The big issue at the moment is actually applying the effect to the user if their armor or weapon contains the correct lore, such as "&7Afterlife". Reloading the scripts results in error based on the script trying to identify "for 2 seconds"as an entity, as well as not finding the loop for which to apply swiftness to a player.

Images: Chat error messages & GUI
txt file: Updated script file
 

Attachments

  • 00.png
    00.png
    114.5 KB · Views: 89
  • 0.png
    0.png
    124.1 KB · Views: 97
  • enchants updated.txt
    3.9 KB · Views: 120
Code:
command /enchanter:
        permission: enchanter.use
        permission message: &cSomething broke...
        trigger:
                set {_gui} to a new chest inventory with 1 row with name "        &e&k&lAA&r &7&lENCHANTER &e&k&lAA&r"
                set {_item} to nether star named "&eRandom Custom Enchantment"
                set line 1 of lore of {_item} to "&7Costs &e1x Diamond Block&7!"
                set slot 4 of {_gui} to {_item}
                set {_item} to enchanted book named "&eAvailable enchantments:"
                set line 1 of lore of {_item} to "&e&lSword &7Crippling"
                set line 2 of lore of {_item} to "&e&lBoots &7Speed"
                set line 3 of lore of {_item} to "&e&lChest &7Shockwave"
                set line 4 of lore of {_item} to "&e&lHelmet &7Escapist"
                set line 5 of lore of {_item} to "&e&lLegs &7Bounce"
                set slot 0 of {_gui} to {_item}
                open {_gui} to player
              
on inventory click:
        if name of event-inventory is "        &e&k&lAA&r &7&lENCHANTER &e&k&lAA&r":
                if index of event-slot = 4:
                cancel event
                if player has diamond block:
                        set {custom.enchant} to random integer between 1 and 5
                        if {custom.enchant} is 1:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Crippling"
                                set line 1 of lore of {_book} to "&7Chance to apply &eblindess &7and &e slowness effects"
                                set line 2 of lore of {_book} to "&7on the enemy!"
                                set line 3 of lore of {_book} to "&eSword Enchantment"
                                give player {_book}
                                send "&7Received the &eCrippling&7 Enchantment" to player
                        if {custom.enchant} is 2:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Speed"
                                set line 1 of lore of {_book} to "&7Applies &espeed effect &7to the user!"
                                set line 2 of lore of {_book} to "&eBoots Enchantment"
                                give player {_book}
                                send "&7Received the &eSpeed&7 Enchantment" to player
                        if {custom.enchant} is 3:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Shockwave"
                                set line 1 of lore of {_book} to "&7Chance to apply &enausea effect&7 and"
                                set line 2 of lore of {_book} to "&estrike lightning &7on the enemy!"
                                set line 3 of lore of {_book} to "&eChestplate Enchantment"
                                give player {_book}
                                send "&7Received the &eShockwave&7 Enchantment" to player
                        if {custom.enchant} is 4:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Escapist"
                                set line 1 of lore of {_book} to "&7Applies &einvisibility &7and &espeed effects"
                                set line 2 of lore of {_book} to "&7to the user when health reaches three hearts or lower!"
                                set line 3 of lore of {_book} to "&eHelmet Enchantment"
                                give player {_book}
                                send "&7Received the &eEscapist&7 Enchantment" to player
                        if {custom.enchant} is 5:
                                remove diamond block from player
                                set {_book} to enchanted book named "&7Bounce"
                                set line 1 of lore of {_book} to "&7Applies &ejump boost effect &7to the user!"
                                set line 2 of lore of {_book} to "&eLeggings Enchantment"
                                give player {_book}
                                send "&7Received the &eBounce&7 Enchantment" to player
                close player's inventory

on inventory click:
        if cursor slot of player is enchanted book:
                if name of cursor slot of player is "&7Crippling":
                        if event-item is any swords:
                                if lore of event-item doesn't contain "&7Crippling":
                                        cancel the event
                                        set {_item} to event-item
                                        remove {_item} from player
                                        add "&7Crippling" to lore of {_item}
                                        give player {_item}
                                        send "&7[&e&lENCHANTER&7] &eCrippling&7 successfully applied!" to the player
                                        set cursor slot of player to air
                if name of cursor slot of player is "&7Speed":
                        if event-item is any boots:
                                if lore of event-item doesn't contain "&7Speed":
                                        cancel the event
                                        set {_item} to event-item
                                        remove {_item} from player
                                        add "&7Speed" to lore of {_item}
                                        give player {_item}
                                        send "&7[&e&lENCHANTER&7] &eSpeed&7 successfully applied!" to the player
                                        set cursor slot of player to air
                if name of cursor slot of player is "&7Shockwave":
                        if event-item is any chestplate:
                                if lore of event-item doesn't contain "&7Shockwave":
                                        cancel the event
                                        set {_item} to event-item
                                        remove {_item} from player
                                        add "&7Shockwave" to lore of {_item}
                                        give player {_item}
                                        send "&7[&e&lENCHANTER&7] &eShockwave&7 successfully applied!" to the player
                                        set cursor slot of player to air
                if name of cursor slot of player is "&7Escapist":
                        if event-item is any helmet:
                                if lore of event-item doesn't contain "&7Escapist":
                                        cancel the event
                                        set {_item} to event-item
                                        remove {_item} from player
                                        add "&7Escapist" to lore of {_item}
                                        give player {_item}
                                        send "&7[&e&lENCHANTER&7] &eEscapist&7 successfully applied!" to the player
                                        set cursor slot of player to air
                if name of cursor slot of player is "&7Bounce":
                        if event-item is any leggings:
                                if lore of event-item doesn't contain "&7Bounce":
                                        cancel the event
                                        set {_item} to event-item
                                        remove {_item} from player
                                        add "&7Bounce" to lore of {_item}
                                        give player {_item}
                                        send "&7[&e&lENCHANTER&7] &eBounce&7 successfully applied!" to the player
                                        set cursor slot of player to air
                                        
on damage:
        if lore of attacker's weapon contains "&7Crippling":
                chance of 10%:
                        apply blindness 1 to victim for 3 seconds
                        apply slowness 2 to victim for 3 seconds

on damage:
        if lore of victim's chestplate contains "&7Shockwave":
                chance of 12%:
                        apply nausea 2 to attacker for 2 seconds
                        strike lightning effect at the attacker
                        damage attacker by 1 heart
                        
on damage:
        if victim's health <= 3:
                if lore of victim's helmet contains "&7Escapist":
                        apply swiftness 2 to victim for 5 seconds
                        apply invisibility to victim for 5 seconds
                        wait 5 seconds
                        remove swiftness from victim
                
every 2 seconds:
        loop all players:
                if lore of loop-player's boots contains "&7Speed":
                        apply swiftness 1 to loop-player for 2.01 seconds

every 2 seconds:
        loop all players:
                if lore of loop-player's leggings contains "&7Bounce":
                        apply jump boost 2 to loop-player for 2.01 seconds

Here's the working Skript if anyone wants to use it
 
Status
Not open for further replies.