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.

Random Potion effect

Discussion in 'Skript' started by ZombiePigmanDude, Apr 4, 2021.

Thread Status:
Not open for further replies.
  1. ZombiePigmanDude

    Joined:
    Apr 7, 2020
    Messages:
    2
    Likes Received:
    0
    Title self explanatory, I want the skript to give the player a random potion effect when right clicking. Currently I'm not sure how to accomplish this, This is the code i have so far
    Code (Text):
    1.  
    2. on right click:
    3.    if player is holding a stick named "&f&lCig":
    4.        #Give player random potion effect?
    5.  
    Is there a way I could loop all potion effects and give player a random one, or would there be a simpler solution?
    Any would be awesome
     
  2. Mattia

    Mattia Member

    Joined:
    Apr 4, 2021
    Messages:
    30
    Likes Received:
    1
    Code (Text):
    1. on right click:
    2.  if player is holding a stick:
    3.   set {_num} to a random integer between 1 and {maxpotions}
    4.   apply {%{_num}%.potion} 3 to the player
    5.   send "You now have the %{%{_num}%.potion}% effect!" to player
    6.  
    7. command /potionadd <potion>:
    8.  trigger:
    9.   add 1 to {maxpotions}
    10.   set {_currentpotion} to {maxpotion}
    11.   set {%{_currentpotion}%.potion} to arg-1
    I didn't add command permission or anything because I was lazy, and this is the best option that i have came up with. I haven't tested it in game but in the parser it says that it has no errors
     
Thread Status:
Not open for further replies.

Share This Page

Loading...