Questions and Questions (Custom enchants)

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

WiebeHero

Active Member
Aug 23, 2017
135
5
0
23
So these are some questions i want some clarification on so here are a few hopefully you can help me.
#1. Custom enchants working on everything.
I made some lored enchants wich wierdly activate regardless of bieing in the code that it needs to have the lore to activate here is the code i have at the moment:
on damage:
attacker is a player
chance of 10%
if lore of attacker's held item contains "Wither I":
apply wither 1 to victim for 10 seconds
#lore1
This will apply for everything for example your fist and stuff and i dont want that.

#2. Having a cooldown for the specific enchant.
So i wanted to make some kind of cooldown for the enchant. I am in 1.12.1 right now so that will do good.
You know the attack cooldowns that have been added in 1.9? Well my custom enchants activate on every move likewise on spam clicking i only want it to activate when it is fully charged of youre attack bar.

If anyone can help me with this it would be much appericiated.
PS: Please if you can show me how it is done in skript.

Best regards: WiebeHero
[doublepost=1505045493,1505045250][/doublepost]Oh and 1 more Question.
#3. Hiding flags and creating new ones.
So i want to have to be able to remove the when in main hand: 1.6 attack speed 4 attack damage and stuff. But afterwards i did that i want to still be able to get new flags on it likely lore. Thank you for reading.
 
Code:
on damage:
    attacker is a player:
        victim is a player:
            if lore of attacker's tool contains "Enchantment I":
                if {witherEnchantCooldown::%attacker%} is false:
                    chance of 15%:
                        apply wither 1 to victim for 10 seconds
                        set {witherEnchantCooldown::%attacker%} to true
                        wait 15 seconds
                        set {witherEnchantCooldown::%attacker%} to false
                if {witherEnchantCooldown::%attacker%} is true:
                    stop

Haven't tested it but theoretically it should work/give you an idea. And also, about the flag thing, yeah, I don't know, sorry, can't help you.
 
Code:
on damage:
    attacker is a player:
        victim is a player:
            if lore of attacker's tool contains "Enchantment I":
                if {witherEnchantCooldown::%attacker%} is false:
                    chance of 15%:
                        apply wither 1 to victim for 10 seconds
                        set {witherEnchantCooldown::%attacker%} to true
                        wait 15 seconds
                        set {witherEnchantCooldown::%attacker%} to false
                if {witherEnchantCooldown::%attacker%} is true:
                    stop

Haven't tested it but theoretically it should work/give you an idea. And also, about the flag thing, yeah, I don't know, sorry, can't help you.
There's a better way to do the cooldown with script mirror where you can get the current charge of the tool which I'm pretty sure I already told him how to do in another one of his threads (I'll find the link later)
 
There's a better way to do the cooldown with script mirror where you can get the current charge of the tool which I'm pretty sure I already told him how to do in another one of his threads (I'll find the link later)

Yeah there probably is, im using this as a cooldown, it's a bit messy sometimes but hey, as long as it works its all good right?
 
Yeah there probably is, im using this as a cooldown, it's a bit messy sometimes but hey, as long as it works its all good right?
The thing is it only half works because after the 15 seconds they could have swung the sword more times so it could only be half charged but it would still let them use the enchant.

With skript mirror you can make it only work when their tool is precisely fully charged
 
Yeah there probably is, im using this as a cooldown, it's a bit messy sometimes but hey, as long as it works its all good right?
The thing is it doesn't work. If the server crashes during those 15 seconds, the player will never be able to use that enchantment again
 
The thing is it doesn't work. If the server crashes during those 15 seconds, the player will never be able to use that enchantment again
Code:
on skript load/server start:
    delete {witherEnchantCooldown::*}

That should fix it, ye?
 
Status
Not open for further replies.