Skript

Skript

743k Downloads

Skript not working when potion effect is at level 2+

Lorafen223 opened this issue ยท 7 comments

commented

Skript/Server Version

Skript 2.8.0 Spigot 1.20.4

Bug Description

obraz

Expected Behavior

Expected this code to work

Steps to Reproduce

on damage:
attacker is player
victim is creeper
if victim doesn't have potion effect speed:
apply speed to victim for 7 seconds
send "You enraged the creeper!" to attacker
else if victim has potion effect speed:
apply speed 2 to victim for 10 seconds
send "You enraged the creeper even more" to the attacker
on damage:
attacker is creeper
victim is player
if attacker has potion effect speed:
apply nausea 2 to victim for 9 seconds
apply blindness to victim for 2 seconds
increase damage by 100%
else if attacker has potion effect speed 2:
apply nausea 2 to victim for 15 seconds
apply blindness to victim for 2 seconds
increase damage by 200%

stop

Errors or Screenshots

else if attacker has potion effect speed 2: not working when putting "2" after speed

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
commented

If you want tiers, you use the potion effect expression, which looks like potion effect of speed 2.
You're missing the of.
https://docs.skriptlang.org/docs.html?search=#ExprPotionEffect

You may also need to use the potion effects of entity expression and check if that contains your requested potion effect.

Alternatively, you can check if the level of speed of attacker is 2, I believe.

commented

Tried your code, when I added "of" I still got error, and when I used "level of speed of attacker is 2" This part of code didn't work.

commented

Your attacker and victim check is wrong.
it's "if attacker is a player"
and "if victim is a player"
same with the creeper.
"if attacker is a creeper"
"if victim is a creeper"

commented

It's only about speed level, when I delete the "2" the code compiles. I didn't put ifs in my previous code for headshots and it is working well.

commented

Tried your code, when I added "of" I still got error, and when I used "level of speed of attacker is 2" This part of code didn't work.

This is likely because you had:

if attacker has potion effect speed:
    ...
else if level of speed of attacker is 2:
    ...

which will never reach the second condition, because in order to have speed 2, you have to have speed.

commented

I'm closing this, as it's a user error, not a Skript bug. You can get more help in the SkUnity discord: discord.gg/skript

(though it does show that we really need a potions rework if just for clarity)

commented

Sorry, I don't understand (btw I'm beginner skripter).