How would I make an item that applies a random buff?

I want to add an item to my game that causes you to gain a random buff of any kind. How would I do this? I was trying to use a common event, but there's no way to add buffs through that, and even if there was there's no way to apply them to the exact party member that was chosen that I know of.
but there's no way to add buffs through that, and even if there was there's no way to apply them to the exact party member that was chosen that I know of.
adding the buffs would have to be done with script calls, but as for getting the target, MZ has the option of storing the id of the battler last targeted by a skill. with that, youd be able to identify the actor.

You could do this with just the damage formula if the item also heals or you dont mind a 0 damage/healing popup
b.addBuff(Math.randomInt(8), 5) would add a random buff for 5 turns

otherwise, youd could use the common event, store the target id into a variable, and then run the script call using that variable's value on the correct actor
https://forums.rpgmakerweb.com/index.php?threads/creating-random-effect-skill.137079/post-1191648
Have the item call a common event

In the common event set a variable to be Random from 0-However Many
(And a variable based on who used the item)
After that, create conditional branches that check for that variable
(Nested within branches for each party member)
Set it so that if the variable is 0, that branch sets whatever buff
If it's 1, set another, different buff
If it's 2, set another, different buff

All of this is easily doable without any plugins 🙂

Edit: Just saw Robro gave this exact same answer! My b for not reading the full thread before wading in to attempt a solution 😀
Have the item call a common event

In the common event set a variable to be Random from 0-However Many
(And a variable based on who used the item)
After that, create conditional branches that check for that variable
(Nested within branches for each party member)
Set it so that if the variable is 0, that branch sets whatever buff
If it's 1, set another, different buff
If it's 2, set another, different buff

All of this is easily doable without any plugins 🙂

Edit: Just saw Robro gave this exact same answer! My b for not reading the full thread before wading in to attempt a solution 😀
yeah that would be good, but there's no way to set buffs in a common event, i tried the script on the big excel doc with everything but that didn't work.
i tried the script on the big excel doc with everything but that didn't work.
you would have to show us what you did for us to be able to tell you where you went wrong. i can assure you the script call works when used correctly
1738467657765.png

1738467663148.png


that being said, skills do need to do something other than call a common event in order to avoid a "nothing happened" popup, but the common event still runs and applies a random buff. you could make it add and remove some state to get rid of it
you would have to show us what you did for us to be able to tell you where you went wrong. i can assure you the script call works when used correctly
View attachment 330482
View attachment 330483

that being said, skills do need to do something other than call a common event in order to avoid a "nothing happened" popup, but the common event still runs and applies a random buff. you could make it add and remove some state to get rid of it
Thanks so much! I guess I wrote the script wrong or something but that seemed to work.

Original thread: https://forums.rpgmakerweb.com/threads/how-would-i-make-an-item-that-applies-a-random-buff.175098/