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.

Solved attempting to create items with custom abilities

Discussion in 'Skript' started by DanDot8224, Aug 14, 2021.

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

    DanDot8224 Member

    Joined:
    Aug 14, 2021
    Messages:
    4
    Likes Received:
    1
    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 (Text):
    1. on right click holding ghast tear:
    2.     make player execute /astraldrop
    3.  
    4. command /astraldrop:
    5.     trigger:
    6.         set {_waited} to difference between {astraldrop.%player%.lastused} and now
    7.         if {_waited} is less than 5 minutes:
    8.             message: &cYou're on cooldown! Wait 5 minutes before using this again!
    9.  
    10.         player doesn't have ghast tear
    11.         cancel trigger
    12.  
    13.         if {_waited} > 301 seconds:
    14.         apply potion of regeneration 2 to player for 6 seconds
    15.         apply potion of health boost to player for 14 seconds
    16.             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 (Text):
    1. on right click holding stick:
    2.     make player execute /pogo
    3.  
    4. command /pogo
    5.     trigger:
    6.         set {_waited} to difference between {pogo.%player%.lastused} and now
    7.         if {_waited} is less than 15 seconds:
    8.             message:  &cYou're on cooldown! Wait 15 seconds before using this again!
    9.  
    10.         player doesn't have stick
    11.         cancel trigger
    12.  
    13.         if {_waited} > 16 seconds:
    14.         push player upwards
    15.             message: &7&oWhooosh


     
    #1 DanDot8224, Aug 14, 2021
    Last edited: Aug 14, 2021
  2. Best Answer:
    Post #5 by xdh, Aug 14, 2021
  3. Tenfont

    Tenfont Member

    Joined:
    Mar 28, 2021
    Messages:
    24
    Likes Received:
    2
    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
     
    #2 Tenfont, Aug 14, 2021
    Last edited: Aug 14, 2021
    • Agree Agree x 1
  4. DanDot8224

    DanDot8224 Member

    Joined:
    Aug 14, 2021
    Messages:
    4
    Likes Received:
    1
    *updated it* sorry
     
  5. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    We cannot help you without code blocks
    [​IMG]
     
    • Like Like x 1
  6. xdh

    xdh Member

    Joined:
    Apr 15, 2020
    Messages:
    46
    Likes Received:
    2
    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.

    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 (Text):
    1. message "&cYou're on cooldown! Wait 5 minutes before using this again!"
    2. stop
    Here's the astral drop using a command
    Code (Text):
    1. command /astraldrop:
    2.     trigger:
    3.         set {_waited} to difference between {astraldrop.%player%.lastused} and now
    4.         if {_waited} is less than 5 minutes:
    5.             message "&cYou're on cooldown! Wait 5 minutes before using this again!"
    6.             stop
    7.  
    8.         if player has ghast tear:
    9.  
    10.             apply potion of regeneration 2 to player for 6 seconds
    11.             apply potion of health boost to player for 14 seconds
    12.             message "&7You have used the power of the &f&lAstral Drop &7use this short burst of power wisely."
    13.  
    14.             set {astraldrop.%player%.lastused} to now
    15.  
    16. on right click:
    17.     if player's held item is ghast tear:
    18.         make player execute command "/astraldrop"
    Here is how I'd do it with functions

    Code (Text):
    1. function astraldrop(p: player):
    2.     set {_waited} to difference between {astraldrop.%{_p}%.lastused} and now
    3.     if {_waited} is less than 5 minutes:
    4.         message "&cYou're on cooldown! Wait 5 minutes before using this again!" to {_p}
    5.         stop
    6.     if {_p} has ghast tear:
    7.         apply potion of regeneration 2 to {_p} for 6 seconds
    8.         apply potion of health boost to {_p} for 14 seconds
    9.         message "&7You have used the power of the &f&lAstral Drop &7use this short burst of power wisely." to {_p}
    10.  
    11.         set {astraldrop.%{_p}%.lastused} to now
    12.  
    13. on right click:
    14.     if player's held item is ghast tear:
    15.         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 (Text):
    1. 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.
     
    • Winner Winner x 1
  7. DanDot8224

    DanDot8224 Member

    Joined:
    Aug 14, 2021
    Messages:
    4
    Likes Received:
    1
    You're a legend. Didn't know I could use functions going to help a lot in the future thanks.
     
    • Like Like x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...