Solved attempting to create items with custom abilities

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

DanDot8224

Member
Aug 14, 2021
4
1
3
19
Receiving https://imgur.com/2CW8SXr this not sure what needs indenting or changing lines affected are highlighted in pink

# AstralDrop - applies regeneration 1 and health boost 2 to the player for a short period of time. player must have ghast tear for Astral effects to be applied, (cooldown = 5 minutes). So on right click -> if player is holding ghast tear -> apply effects. if player doesn't have stick -> cancel

Code:
on right click holding ghast tear:
    make player execute /astraldrop

command /astraldrop:
    trigger:
        set {_waited} to difference between {astraldrop.%player%.lastused} and now
        if {_waited} is less than 5 minutes:
            message: &cYou're on cooldown! Wait 5 minutes before using this again!

        player doesn't have ghast tear
        cancel trigger

        if {_waited} > 301 seconds:
        apply potion of regeneration 2 to player for 6 seconds
        apply potion of health boost to player for 14 seconds
            message: &7You have used the power of the &f&lAstral Drop &7use this short burst of power wisely.

# Pogo Stick - launcher player into the air (push player upwards). Players must have stick for it to work, (cooldown of 15 seconds)

Code:
on right click holding stick:
    make player execute /pogo

command /pogo
    trigger:
        set {_waited} to difference between {pogo.%player%.lastused} and now
        if {_waited} is less than 15 seconds:
            message:  &cYou're on cooldown! Wait 15 seconds before using this again!

        player doesn't have stick
        cancel trigger

        if {_waited} > 16 seconds:
        push player upwards
            message: &7&oWhooosh
 
Last edited:
Anyone know what I'm doing wrong and if you can help me fix it? highlighted in green is what i'm trying to achieve in the script below
Do you expect us to magically figure out which part of it is not working, and post the solution?

What isn't working? What are the errors you are getting, if any? You need to provide this info

EDIT: Also, you seem to be missing a few semi-colons on your if-statements
 
Last edited:
Do you expect us to magically figure out which part of it is not working, and post the solution?

What isn't working? What are the errors you are getting, if any? You need to provide this info

EDIT: Also, you seem to be missing a few semi-colons on your if-statements
*updated it* sorry
 
We cannot help you without code blocks
dUToA6d.png
 
  • Like
Reactions: DanDot8224
How to add a code block:

upload_2021-8-14_21-17-10.png


Anyways you don't have to use commands for abilities, you can use functions unless you want it to be a command.

Receiving https://imgur.com/2CW8SXr this not sure what needs indenting or changing lines affected are highlighted in pink

Note: Not sure how to make a code block so pastebin below if someone can lmk how to make a code block please do so I know for future reference
https://pastebin.com/ZKyRsAxQ

# AstralDrop - applies regeneration 1 and health boost 2 to the player for a short period of time. player must have ghast tear for Astral effects to be applied, (cooldown = 5 minutes). So on right click -> if player is holding ghast tear -> apply effects. if player doesn't have stick -> cancel

on right click holding ghast tear:
make player execute /astraldrop

command /astraldrop:
trigger:
set {_waited} to difference between {astraldrop.%player%.lastused} and now
if {_waited} is less than 5 minutes:
message: &cYou're on cooldown! Wait 5 minutes before using this again!

player doesn't have ghast tear
cancel trigger

if {_waited} > 301 seconds:
apply potion of regeneration 2 to player for 6 seconds
apply potion of health boost to player for 14 seconds
message: &7You have used the power of the &f&lAstral Drop &7use this short burst of power wisely.

# Pogo Stick - launcher player into the air (push player upwards). Players must have stick for it to work, (cooldown of 15 seconds)

on right click holding stick:
make player execute /pogo

command /pogo
trigger:
set {_waited} to difference between {pogo.%player%.lastused} and now
if {_waited} is less than 15 seconds:
message: &cYou're on cooldown! Wait 15 seconds before using this again!

player doesn't have stick
cancel trigger

if {_waited} > 16 seconds:
push player upwards
message: &7&oWhooosh
you don't have to use "if {_waited} > 16 seconds:" literally pointless all you have to do is add a "stop" after the cooldown message so, and then set {astraldrop.%player%.lastused} to now

Code:
message "&cYou're on cooldown! Wait 5 minutes before using this again!"
stop

Here's the astral drop using a command
Code:
command /astraldrop:
    trigger:
        set {_waited} to difference between {astraldrop.%player%.lastused} and now
        if {_waited} is less than 5 minutes:
            message "&cYou're on cooldown! Wait 5 minutes before using this again!"
            stop

        if player has ghast tear:

            apply potion of regeneration 2 to player for 6 seconds
            apply potion of health boost to player for 14 seconds
            message "&7You have used the power of the &f&lAstral Drop &7use this short burst of power wisely."

            set {astraldrop.%player%.lastused} to now

on right click:
    if player's held item is ghast tear:
        make player execute command "/astraldrop"

Here is how I'd do it with functions

Code:
function astraldrop(p: player):
    set {_waited} to difference between {astraldrop.%{_p}%.lastused} and now
    if {_waited} is less than 5 minutes:
        message "&cYou're on cooldown! Wait 5 minutes before using this again!" to {_p}
        stop
    if {_p} has ghast tear:
        apply potion of regeneration 2 to {_p} for 6 seconds
        apply potion of health boost to {_p} for 14 seconds
        message "&7You have used the power of the &f&lAstral Drop &7use this short burst of power wisely." to {_p}

        set {astraldrop.%{_p}%.lastused} to now

on right click:
    if player's held item is ghast tear:
        astraldrop(player)

Also I saw that the way your using messages is also incorrect, messages require a quotation mark before and after like how I used it, also a faster alternative is:
Code:
send "hello world"

EDIT: I went out of my way, and added the tabs so I can test your skript, next time use code blocks, and show errors to get faster help.
 
How to add a code block:

View attachment 6251

Anyways you don't have to use commands for abilities, you can use functions unless you want it to be a command.


you don't have to use "if {_waited} > 16 seconds:" literally pointless all you have to do is add a "stop" after the cooldown message so, and then set {astraldrop.%player%.lastused} to now

Code:
message "&cYou're on cooldown! Wait 5 minutes before using this again!"
stop

Here's the astral drop using a command
Code:
command /astraldrop:
    trigger:
        set {_waited} to difference between {astraldrop.%player%.lastused} and now
        if {_waited} is less than 5 minutes:
            message "&cYou're on cooldown! Wait 5 minutes before using this again!"
            stop

        if player has ghast tear:

            apply potion of regeneration 2 to player for 6 seconds
            apply potion of health boost to player for 14 seconds
            message "&7You have used the power of the &f&lAstral Drop &7use this short burst of power wisely."

            set {astraldrop.%player%.lastused} to now

on right click:
    if player's held item is ghast tear:
        make player execute command "/astraldrop"

Here is how I'd do it with functions

Code:
function astraldrop(p: player):
    set {_waited} to difference between {astraldrop.%{_p}%.lastused} and now
    if {_waited} is less than 5 minutes:
        message "&cYou're on cooldown! Wait 5 minutes before using this again!" to {_p}
        stop
    if {_p} has ghast tear:
        apply potion of regeneration 2 to {_p} for 6 seconds
        apply potion of health boost to {_p} for 14 seconds
        message "&7You have used the power of the &f&lAstral Drop &7use this short burst of power wisely." to {_p}

        set {astraldrop.%{_p}%.lastused} to now

on right click:
    if player's held item is ghast tear:
        astraldrop(player)

Also I saw that the way your using messages is also incorrect, messages require a quotation mark before and after like how I used it, also a faster alternative is:
Code:
send "hello world"

EDIT: I went out of my way, and added the tabs so I can test your skript, next time use code blocks, and show errors to get faster help.
You're a legend. Didn't know I could use functions going to help a lot in the future thanks.
 
  • Like
Reactions: xdh
Status
Not open for further replies.