Beef. It's what's for dinner.

I was wondering if there was a way a temporary food buff could give a random stat bonus? I thought of using states and setting parameters to different stats at small percentages. But didn't want to give them either no bonuses or too many bonuses.
I think something like that would require a script. It also may be possible to do it in the damage formula...
You could possibly run a random variable in a common event to decide which buff to apply. Depends on how you have it set up. You may need a script call, like @TakeHomeTheCup said.
So how would I do that?
I'm thinking a random variable call that triggers a random state for your bonus might be able to work like @JGreene said. I don't think a script is necessary for something like this. I can probably jot down a step by step tutorial if you'd like, random variables is kind of my thing.
That would be very helpful.
If doing it by states:
Let's say you make a state for each parameter buff.
unknown.png


Assuming Beef is an item, you will put this in the damage formula:
eval $data_items[ITEM-ID].note[/<formula>(.*?)<\/formula>/m, 1]

ITEM-ID = the ID of the item in the database

In the notebox, you put

<formula>
(What you would normally put in the damage formula)
</formula>

What you normally would've put is:
<formula>
rand(4) = v[x]; if v[x] == 1; a.add_state(27); end; if v[x] == 2; a.add_state(28); end; if v[x] = 3; a.add_state(29); end; if v[x] = 4; a.add_state(30); end; 0
</formula>
"x" in v[x] is the variable ID (You will need a variable with this)

The 0 is at the end in case no numerical value is added or subtracted. The skill should look like this:
unknown.png


Haven't tested it, but it should work. The code in the damage formula tells the database to look in the notebox of the specified Item ID (or skill).
If anything doesn't make sense, don't be afraid to ask ^_^
Nope. Can't use it on them.
Screenshot 2017-06-24 21.20.29.png
Screenshot 2017-06-24 21.20.43.png
On you second screenshot, in v[x], the "x" isn't the same number throughout the formula. It's 29 then it goes to 27, and then 28. v[x] must be consistent.

Your damage formula is also wrong. See where you put...
[item-66]

It is just
[66]

You already told the database it's an item's notebox you're looking for when you put $data_items right before it.
states.PNG
variable.PNG
Item.PNG
Ok, so I made a mystery meat variable as 31. I don't know if I'm doing the variable right. But I made sure to add 31 in each of the v[x] spots. I added [66] before but it didn' work. It seems you have an error between the formula under 'What you normally would've put is: "if v[x] = 3;" and in the note tag directly below you have "if c [29] ==3." A 'c' instead of an 'if v'. So is it == or =? Before 3 and 4 there is only a = instead of ==. On "1; a.add_state [26]" I have Beef Buff under 'states.' On ""2; a.add_state [27]" I have Fish Food under 'states.' On "3; a.add_state [28]" I have Chessy Buff under 'states.' On 4; a.add_state [31] I have Bread Buff under 'states.' I finally understand the formula. But still can't get it to work.
I made a rookie mistake. Do v[31] = rand(4)

At first, i showed random of 1 - 4 is equal to whatever variable 31 is which makes no sense; wouldnt be random if so.

Now, with my suggestion, it'll say variable 31 equals to whatever random 1 - 4 is which does make sense.

Its == bc thats the sign u use for conditionals.
Nope. Have you tried to see if it works?
variable2.PNG
redo item 2.PNG
Fixed it. And no, I haven't until now. This one works for me, so if it doesn't work for you, it's not because of this.

If you put this in the notebox, it should work (U may copy/paste as I used ur numbers).
v[31] = rand(4); if v[31] == 1; a.add_state(26); if v[31] == 2; a.add_state(27); if v[31] == 3; a.add_state(28); if v[31] == 4; a.add_state(31); end; end; end; end; 0

All I did was move all the "end" to the end of the damage formula. It worked for me, BUT you'll get a fail message at the top. I suggest using the Anti-Fail script of Yanfly OR go to "Vocab" under "Modules" in the script editor, go to line 82 and make it say nothing.

Anti-Fail Script: Link
Nope. No fail message. Script didn't have any effect either. Just the SF of buzzer1. When something doesn't work.
So did it give you an error message or is it that it won't allow you to select it?
No error message. Just the buzzer sound when I try to use it in on the menu screen.
I'm assuming the issue has something to do with damage formula, but I found a workaround. Put Gain TP 0%, and it should work.
unknown.png
Well, I can use it now. It just doesn't do anything. I copied pasted the damage formula again. With the [66] as the item number.
It certainly works for me. Do you mind sending a demo, so I can look at it?
That's ok. I will just go with my original idea. At least it works for me. I used one mystery meat on each character. One buff, two buffs, one buff, and no buff. But they all still heals for 25% HP. So it's still useful even without a bonus.
beefcake!.PNG
for me.
old idea.PNG

Original thread: https://forums.rpgmakerweb.com/threads/beef-its-whats-for-dinner.80136/