[Scarpet] add `__on_player_effect_changes()` event to scarpet
rv3r opened this issue ยท 2 comments
If it's possible to track, I'd like to be able to use an event that tracks when player effects(haste, speed, fire resistance, etc) are gained, such as by entering beacon radii or drinking potions, or are lost/cleared, such as when milk is drunk or a potion runs out.
I am working on a script that checks for such an event, but I prefer not to use __on_tick()
, and it's possible that others could benefit from this event. Below is a potential functionality description for such an event.
__on_player_effect_changes(player, change, effect, amplifier, ticks)
Triggers when a player gains or loses an effect.
Provides
- player
player
- string
change
with options 'gain' and 'lose' - string
effect
- number
amplifier
- number
ticks
(null
ifchange == 'lose'
).
For beacons, I don't know if it's possible for this to trigger upon effect renewal or if it is limited to the first instance of the effect. Additionally, when the player dies or drinks milk, I realize that the event might have to handle multiple effects being cleared simultaneously by triggering once for each effect.
Of course, since I wouldn't be implementing the event into carpet, I don't mind changes to names or precise functionality; just having an event like this would be awesome.
Possible output from event_test
after drinking an eight minute fire resistance potion:
or when a player leaves the range of a haste 1 beacon and the effect eventually wears off: