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

Getting the level of a potion effect

Discussion in 'Skript' started by TawnyFrogmouth, May 4, 2017.

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

    Joined:
    Apr 4, 2017
    Messages:
    16
    Likes Received:
    0
    I know I can check whether a player has a certain potion effect with a condition like

    Code (Text):
    1. player has resistance
    Is it possible to determine the level of a potion effect currently affecting a player?

    What I'm aiming for here is the following: I want to apply a potion effect to a player periodically:
    Code (Text):
    1. remove resistance from loop-player
    2. apply resistance 2 to loop-player for 12 seconds
    However, I'd like to skip this code if the player already has a higher level of resistance. Is this possible?
     
  2. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,278
    Likes Received:
    79
    Looks like you can do it with SkMorkaz:

    Potion Tier
    Addon: SkMorkaz
    Patterns:
    [mor.]potion tier [of] %string% of (%player%|%entity%)
    Returns tier number of specific potion if it is applied to specific player. If not, it returns 0.
    Please use Bukkit potion names in text, like as in example.

    @Edit
    Version 0.2+ Supports getting tier of potion from entities and players.
    Example:
    set {_tier.number} to potion tier of "SLOW" of player

    http://skunity.com/search?search=tier
     
  3. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,278
    Likes Received:
    79
    With QuarSK:
    Code (Skript):
    1. loop active potion effects of player:,
    2.     if potion type of loop-potion effect is resistance:
    3.         if tier of loop-potion effect is less than 3:
    4.             #do stuff
     
Thread Status:
Not open for further replies.
Loading...