Skript: Suggestion: more in-depth potion/status effect related expressions

Created on 9 Aug 2018  路  3Comments  路  Source: SkriptLang/Skript

loop player's potion/status effects:

Can be achieved with LivingEntity.getActivePotionEffects()
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/LivingEntity.html#getActivePotionEffects--

length/duration of potion/status effect %potioneffect%

Can be achieved with LivingEntity.getPotionEffect(PotionEffectType ).getDuration()
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffect.html#getDuration--
This method will return the remaining minecraft ticks of the effect

multiplier/modifier of potion/status effect %potioneffect%

Can be achieved with LivingEntity.getPotionEffect(PotionEffectType ).getAmplifier()
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffect.html#getAmplifier--
This would be quite useful in regards of checking wether player's (still) have potion effects that can not be acquired by them during normal gameplay. Taking vanilla minecraft as example, player's can never get a higher tier strength potion than level 2 (1 as amplifier-value). Night vision can never be a higher tier than level 1 (0 as amplifier), and so on

There are some more methods that can be used in regards to potion effects that skript currently does not make any use of: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffect.html
However i limited myself to suggesting the most useful here

Further, i would like to advertise the addition of the ability to either set and add to the duration of a potion effect. I couldn't find an open issue about this on this github, but many times i've stumbled upon (especially new) skript users, that were confused as to why applying a potion effect to an entity would extend the duration of an existing potion effect, rather than setting the duration. The current solution to this is:

remove %potioneffect% from entity
apply %potioneffect% 1 to entity

Thank you for reading

enhancement

Most helpful comment

Aliases rework gets rid of some potion item hackery. This should be revisited after it.

All 3 comments

i tried to add these once but it needs a decent rework of potions internally in skript.

Aliases rework gets rid of some potion item hackery. This should be revisited after it.

From #2962: The ability to test if a player has %potioneffect% would be nice.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Snow-Pyon picture Snow-Pyon  路  4Comments

DeagoTheDoggo picture DeagoTheDoggo  路  3Comments

ghost picture ghost  路  3Comments

GiraffeCubed picture GiraffeCubed  路  3Comments

MrScopes picture MrScopes  路  3Comments