1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Questions and Questions (Custom enchants)

Discussion in 'Skript' started by WiebeHero, Sep 10, 2017.

Tags:
Thread Status:
Not open for further replies.
  1. WiebeHero

    WiebeHero Well-Known Member

    Joined:
    Aug 23, 2017
    Messages:
    135
    Likes Received:
    4
    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
    --- Double Post Merged, Sep 10, 2017, Original Post Date: Sep 10, 2017 ---
    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.
     
  2. CrimZ0N

    CrimZ0N Member

    Joined:
    Jan 28, 2017
    Messages:
    50
    Likes Received:
    3
    Code (Text):
    1.  
    2. on damage:
    3.     attacker is a player:
    4.         victim is a player:
    5.             if lore of attacker's tool contains "Enchantment I":
    6.                 if {witherEnchantCooldown::%attacker%} is false:
    7.                     chance of 15%:
    8.                         apply wither 1 to victim for 10 seconds
    9.                         set {witherEnchantCooldown::%attacker%} to true
    10.                         wait 15 seconds
    11.                         set {witherEnchantCooldown::%attacker%} to false
    12.                 if {witherEnchantCooldown::%attacker%} is true:
    13.                     stop
    14.  
    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.
     
  3. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    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)
     
  4. CrimZ0N

    CrimZ0N Member

    Joined:
    Jan 28, 2017
    Messages:
    50
    Likes Received:
    3
    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?
     
  5. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    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
     
  6. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    126
    Medals:
    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
     
  7. CrimZ0N

    CrimZ0N Member

    Joined:
    Jan 28, 2017
    Messages:
    50
    Likes Received:
    3
    Code (Text):
    1.  
    2. on skript load/server start:
    3.     delete {witherEnchantCooldown::*}
    4.  
    That should fix it, ye?
     
Thread Status:
Not open for further replies.
Loading...