Can

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

Nerf Thiss

New Member
Apr 19, 2020
8
0
1
22
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:
on mine of coal ore:
    if {ore} is true:
        cancel the event
        give player 1 coal named "&7Coal" with lore "&7&lCOMMON"
        set {_exp} to a random integer from 0 and 2
        if {_exp} is 0:
            send action bar "&a+0 exp" to player
        if {_exp} is 1:
            send action bar "&a+1 exp" to player
            give 1 exp to the player
        if {_exp} is 2:
            send action bar "&a+2 exp" to player
            give 2 exp to the player
        set {bedrock.%player%} to true
        set event-block to bedrock
        wait 5 seconds
        set event-block to coal ore
        set {bedrock.%player%} to false
        if player's tool is golden pickaxe:
            if name of tool is "&e&lMidas Touch":
                if {midas::%player%} is true:
                    play raw sound "entity.player.levelup" at player with pitch 5 volume 10
                    give player 3 gold ingots named "&aGold Ingot"

The ability's variable is activated by this:

Code:
on right-click:
    if player's tool is golden pickaxe:
        if name of tool is "&e&lMidas Touch":
            {cooldown::%player%} is true:
                {midas::%player%} is true:
                    send action bar "&7⋙ &eSkill already active! &7⋘" to player
                    cancel event
                    stop
                cancel event
                send action bar "&7⋙ &cYour item is charging! &7⋘" to player
                stop
            else:
                set {cooldown::%player%} to true
                set {midas::%player%} to true
                send action bar "&6⋙ &eMidas Touch active! &6⋘" to player
                wait 7 seconds
                set {midas::%player%} to false
                send action bar "&6⋙ &eMidas Touch has worn off. &6⋘" to player
                wait 10 seconds
                clear {cooldown::%player%}
                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.
 
Please stay attached to the Help request format before posting. https://forums.skunity.com/wiki/help-request-layout/

Which errors do you have? skript version? addons?

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:
if player's tool is golden pickaxe:
            if name of tool is "&e&lMidas Touch":
                if {midas::%player%} is true:
                    play raw sound "entity.player.levelup" at player with pitch 5 volume 10
                    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:
on mine of coal ore:
    if {ore} is true:
        cancel the event
        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.
 
try this
Code:
on mine of coal ore:

    if {ore} is true:
        cancel the event
        set {_exp} to a random integer from 0 and 2
        if {_exp} is 0:
            send action bar "&a+0 exp" to player
        if {_exp} is 1:
            send action bar "&a+1 exp" to player
            give 1 exp to the player
        if {_exp} is 2:
            send action bar "&a+2 exp" to player
            give 2 exp to the player
        set {bedrock.%player%} to true
        set event-block to bedrock
        wait 5 seconds
        set event-block to coal ore
        set {bedrock.%player%} to false
        if player's tool is golden pickaxe:
            if name of tool is "&e&lMidas Touch":
                if {midas::%player%} is true:
                    play raw sound "entity.player.levelup" at player with pitch 5 volume 10
                    give player 3 gold ingots named "&aGold Ingot"
                    stop
        give player 1 coal named "&7Coal" with lore "&7&lCOMMON"
 
try this
Code:
on mine of coal ore:

    if {ore} is true:
        cancel the event
        set {_exp} to a random integer from 0 and 2
        if {_exp} is 0:
            send action bar "&a+0 exp" to player
        if {_exp} is 1:
            send action bar "&a+1 exp" to player
            give 1 exp to the player
        if {_exp} is 2:
            send action bar "&a+2 exp" to player
            give 2 exp to the player
        set {bedrock.%player%} to true
        set event-block to bedrock
        wait 5 seconds
        set event-block to coal ore
        set {bedrock.%player%} to false
        if player's tool is golden pickaxe:
            if name of tool is "&e&lMidas Touch":
                if {midas::%player%} is true:
                    play raw sound "entity.player.levelup" at player with pitch 5 volume 10
                    give player 3 gold ingots named "&aGold Ingot"
                    stop
        give player 1 coal named "&7Coal" with lore "&7&lCOMMON"

Unfortunately, it doesn't work :emoji_frowning: It also adds a 5-second delay between mining and getting the ore.
[doublepost=1587312867,1587312493][/doublepost]
Unfortunately, it doesn't work :emoji_frowning: It also adds a 5-second delay between mining and getting the ore.

SORRY- nevermind. The only thing wrong is the delay.
 
Status
Not open for further replies.