Getting the level of a potion effect

  • 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.
Apr 4, 2017
16
0
0
41
I know I can check whether a player has a certain potion effect with a condition like

Code:
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:
remove resistance from loop-player
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?
 
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
 
With QuarSK:
code_language.skript:
loop active potion effects of player:,
    if potion type of loop-potion effect is resistance:
        if tier of loop-potion effect is less than 3:
            #do stuff
 
Status
Not open for further replies.