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

Can

Discussion in 'Skript' started by Nerf Thiss, Apr 19, 2020.

Thread Status:
Not open for further replies.
  1. Nerf Thiss

    Nerf Thiss New Member

    Joined:
    Apr 19, 2020
    Messages:
    8
    Likes Received:
    0
    Title was meant to be named "Cant get ability with time limit to work with other skript"

    I'm an amateur at skript and this is the first time I've ever tried to write something like this. I'm trying to make a right-click-ability compatible with one of my skripts installed. I tried putting them like this:


    Code (Text):
    1. on mine of coal ore:
    2.     if {ore} is true:
    3.         cancel the event
    4.         give player 1 coal named "&7Coal" with lore "&7&lCOMMON"
    5.         set {_exp} to a random integer from 0 and 2
    6.         if {_exp} is 0:
    7.             send action bar "&a+0 exp" to player
    8.         if {_exp} is 1:
    9.             send action bar "&a+1 exp" to player
    10.             give 1 exp to the player
    11.         if {_exp} is 2:
    12.             send action bar "&a+2 exp" to player
    13.             give 2 exp to the player
    14.         set {bedrock.%player%} to true
    15.         set event-block to bedrock
    16.         wait 5 seconds
    17.         set event-block to coal ore
    18.         set {bedrock.%player%} to false
    19.         if player's tool is golden pickaxe:
    20.             if name of tool is "&e&lMidas Touch":
    21.                 if {midas::%player%} is true:
    22.                     play raw sound "entity.player.levelup" at player with pitch 5 volume 10
    23.                     give player 3 gold ingots named "&aGold Ingot"
    The ability's variable is activated by this:

    Code (Text):
    1. on right-click:
    2.     if player's tool is golden pickaxe:
    3.         if name of tool is "&e&lMidas Touch":
    4.             {cooldown::%player%} is true:
    5.                 {midas::%player%} is true:
    6.                     send action bar "&7⋙ &eSkill already active! &7⋘" to player
    7.                     cancel event
    8.                     stop
    9.                 cancel event
    10.                 send action bar "&7⋙ &cYour item is charging! &7⋘" to player
    11.                 stop
    12.             else:
    13.                 set {cooldown::%player%} to true
    14.                 set {midas::%player%} to true
    15.                 send action bar "&6⋙ &eMidas Touch active! &6⋘" to player
    16.                 wait 7 seconds
    17.                 set {midas::%player%} to false
    18.                 send action bar "&6⋙ &eMidas Touch has worn off. &6⋘" to player
    19.                 wait 10 seconds
    20.                 clear {cooldown::%player%}
    21.                 send action bar "&7⋙ Midas Touch is now ready. &7⋘" to player
    My code's probably littered with errors as it's my first try, but I can't exactly find what's wrong with the code.
     
  2. krainser

    krainser Member

    Joined:
    Jan 27, 2017
    Messages:
    60
    Likes Received:
    3
  3. Nerf Thiss

    Nerf Thiss New Member

    Joined:
    Apr 19, 2020
    Messages:
    8
    Likes Received:
    0
    Oh, really sorry.
    Skript Version
    2.4 (1.15.2)

    Addons
    skRayfall v1.9.20, skDragon v0.16, TuSKe v1.8.2, skQuery 4.1.2

    Main Issue
    I'm trying to get these lines of code:
    Code (Text):
    1. if player's tool is golden pickaxe:
    2.             if name of tool is "&e&lMidas Touch":
    3.                 if {midas::%player%} is true:
    4.                     play raw sound "entity.player.levelup" at player with pitch 5 volume 10
    5.                     give player 3 gold ingots named "&aGold Ingot"
    To cancel out this one (Instead of getting coal from the coal ore, the condition added makes it give gold ingots.):
    Code (Text):
    1. on mine of coal ore:
    2.     if {ore} is true:
    3.         cancel the event
    4.         give player 1 coal named "&7Coal" with lore "&7&lCOMMON"
    I want the regenerating ores to still function, though. (When the coal ore is broken, due to the activated ability, it would drop gold ingots. But the ores still regenerate normally.)

    I want this condition to only be true when it is activated by a right-click with a custom item.
     
  4. krainser

    krainser Member

    Joined:
    Jan 27, 2017
    Messages:
    60
    Likes Received:
    3
    try this
    Code (Text):
    1. on mine of coal ore:
    2.  
    3.     if {ore} is true:
    4.         cancel the event
    5.         set {_exp} to a random integer from 0 and 2
    6.         if {_exp} is 0:
    7.             send action bar "&a+0 exp" to player
    8.         if {_exp} is 1:
    9.             send action bar "&a+1 exp" to player
    10.             give 1 exp to the player
    11.         if {_exp} is 2:
    12.             send action bar "&a+2 exp" to player
    13.             give 2 exp to the player
    14.         set {bedrock.%player%} to true
    15.         set event-block to bedrock
    16.         wait 5 seconds
    17.         set event-block to coal ore
    18.         set {bedrock.%player%} to false
    19.         if player's tool is golden pickaxe:
    20.             if name of tool is "&e&lMidas Touch":
    21.                 if {midas::%player%} is true:
    22.                     play raw sound "entity.player.levelup" at player with pitch 5 volume 10
    23.                     give player 3 gold ingots named "&aGold Ingot"
    24.                     stop
    25.         give player 1 coal named "&7Coal" with lore "&7&lCOMMON"
     
  5. Nerf Thiss

    Nerf Thiss New Member

    Joined:
    Apr 19, 2020
    Messages:
    8
    Likes Received:
    0
    Unfortunately, it doesn't work :emoji_frowning: It also adds a 5-second delay between mining and getting the ore.
    --- Double Post Merged, Apr 19, 2020, Original Post Date: Apr 19, 2020 ---
    SORRY- nevermind. The only thing wrong is the delay.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...