Adding a random buff based on variable?

Hello everyone,


I'm currently trying to implement a skill which I'm having difficulty working with. What the skill entails is this:


-The user applies a buff to self.


-The character then applies a different buff to a random ally which excludes the user from the picking pool.


-If the ally is felled in battle at any time during the battle, the buff the user has is replaced with a debuff that lasts until the end of the encounter.


Is there any way to implement this properly? Thank you for any help provided.
Yes, it can be done, but it's going to be super complex.


Find Yanfly's plugins. One of them lets you execute code, including calling Common Events, when a State is applied or removed.
Yes, it can be done, but it's going to be super complex.


Find Yanfly's plugins. One of them lets you execute code, including calling Common Events, when a State is applied or removed.

I've got all of Yanfly's scripts already, though I don't have much experience to do something like that via scripting. More help would be appreciated into making it work.

Original thread: https://forums.rpgmakerweb.com/threads/adding-a-random-buff-based-on-variable.63773/