Event checking if player has 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 community!

    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!

success009

Member
Oct 5, 2024
2
0
1
after doing that some research I made this script

on potion effect added:
if player has permission "member.wizard":
execute console command "effect clear %player% minecraft:slowness"

Problem with this is this only works if I use command to give the player effect
This doesn't fix the problem with the splash and drinking and tipped arrow.

I tried looping every second but that takes too much load on server and doesn't even work for effects like harming

Is there a way to provide immunity of negative effects to a specific group of player which have specific permissions?
 
Code:
every 2 seconds:
    if player has permission "member.wizard":
        execute console command "effect clear %player% minecraft:slowness"
should stay updated and not cause a lot of lag, you can change the timing to what fits your server best
 
after doing that some research I made this script

on potion effect added:
if player has permission "member.wizard":
execute console command "effect clear %player% minecraft:slowness"

Problem with this is this only works if I use command to give the player effect
This doesn't fix the problem with the splash and drinking and tipped arrow.

I tried looping every second but that takes too much load on server and doesn't even work for effects like harming

Is there a way to provide immunity of negative effects to a specific group of player which have specific permissions?
Python:
on join:
    if player has permission "member.wizard":
        
        async run 0 ticks later:
            while player is online:
                remove slowness from player if potion effects of player contains slowness
                wait a tick

SKBee required.

Will do an async loop so "wait a tick" isn't a problem.
 
Thank you for you guys help
but After some more research I found a better approach
Code:
on entity potion effect modification:
    if event-entity has permission "member.wizard":
        if event-entity is a player:
            if event-potion effect type = poison or darkness or slowness or weakness or mining fatigue or wither or hunger or levitation or unluck or nausea or instant damage:
                cancel event
                send action bar "&aMagic has prevented &c%event-potion effect type%&a!" to event-entity
 
Thank you for you guys help
but After some more research I found a better approach

on entity potion effect modification:
if event-entity has permission "member.wizard":
if event-entity is a player:
if event-potion effect type = poison or darkness or slowness or weakness or mining fatigue or wither or hunger or levitation or unluck or nausea or instant damage:
cancel event
send action bar "&aMagic has prevented &c%event-potion effect type%&a!" to event-entity
this is better