Chance to get back up (instead of K.O) increased by LUK stat?

So, I have a sort of "guts" system in my game.
When my character's hp reaches 0, there's a small chance (10%) of getting back up.
I have coded this with a common event that runs when character hp is 0.
Basically it runs a variable, it randomly selects a number between 0-100, and if the number rolled is below 11, the character gets back up.
Now I'd like to have LUCK be a factor for this too, so the player can effect the chances of the character getting back up (+ possibly the healing received?)
Is that doable?
Of course it is. 🙂 How do you currently have the event set up?
Like so:

20a0cf9d34fe171f6e2f3ba51d21935f.png
What effect do you want luck to have?
first you have to define the maximum LUK and how much that'd affect the calculation.
if your top of LUK is 255, at 12 LUK you're already past the threshold.
What effect do you want luck to have?

to a) increase the chances of getting back up
b) increase hp gained. Right now it's a flat 20% percentage, but that's because I didn't know how to make a stat like luck have effect (so the flat 20% can go away).


Breath of Fire has this system too, where luck can be anywhere between 0-255, I believe at max 255, you had a 25% chance at most to get back up once during battle. (Note, it's once. I haven't coded it to be a one time thing during battle. I wasn't sure how)
Sorry I wasn't clear. I don't mean what you want luck to do, I mean specifically what amount of influence do you want luck to have on the calculation?
Sorry I wasn't clear. I don't mean what you want luck to do, I mean specifically what amount of influence do you want luck to have on the calculation?
Ah. Well. Either one of these two, whatever is easier:
Have luck increase the variable
or
Let the variable (and thus chance to ress) be determined by luck, and not the random1-100+luck.

The latter option sounds easier to balance, I think.
Ah. Well. Either one of these two, whatever is easier:
Have luck increase the variable
or
Let the variable (and thus chance to ress) be determined by luck, and not the random1-100+luck.

The latter option sounds easier to balance, I think.

So you want to apply the full value of luk to the calculation? Can you give me an example of how you want it to go so that I know what code to give you?
So you want to apply the full value of luk to the calculation? Can you give me an example of how you want it to go so that I know what code to give you?


Hmm. Say my max stat for luck is 250 and at 250 (max) chance to ress is 25%.
So that is.. 0.1% per 1 luck.

(I should be able to chance this max value or % per 1 luck on the fly later if possible)
You could have another control variables command after the initial one set to add and "script":

Code:
$game_actors[id of fayhe].luk * 0.1

That'll add 1% of Fahye's luck to the number generated.
So, if she has 20 Luck, that means it adds 2%?
20 luck would add 2 to the random number rolled. Which if it's 1-100 would in effect add 2%, yeah.
Hmm. But then eventually if max luck is added, the chance to ress would be 35%, not 25%.
That's too high. Especially since I don't know how to set a cap on the recovering. Right now you can die 10 times and if Lucky, ress 10 times in one battle.
Use a variable called "times ressed" or something. Make a battle event that sets it to 0 on turn 0. Then in the success branch, increase it by 1 and use it for a conditional branch to make sure it's < res cap beforehand.

As for the chance issue, after the initial variable setting you could do

Code:
$game_variables[101] = [$game_variables[101], 125].min
$game_variables[101] = [$game_variables[101], 125].min
What does this do?

I find I am running into a problem anyway.
I can make the variable roll 1-100
Then add luck

But then the variable still checks whether the roll is <10
So.. that doesn't take luck into equation at all. Just reduces your chances of ressing, if it's higher.
The line ensures that the value of the rolled number never exceeds 125.

But you're right. Hmm.

Maybe make the luck value *subtract* from the rolled number instead of adding to it?

Edit: Orrrrr

Set a variable to your chance value and add the luk modifier to that!

So rather than the conditional branch checking whether it's less than 11, set variable X to 11, add the luk modifier to it (using a similar line afterwards to make sure it's never above 25), and check whether the random number is less than variable X.
How do I do that?
1593614867091.png


Not gonna bother with another updated screenshot but you could even set 102 (or whatever ID your reschance variable has) to "script" and do "10 + $game_actors[1].luk * 0.1" if you wanted to save a line.
Thank you,
I had it coded wrong it seems.
Here's what I have at the moment:


4d28270ab6d41745e7851ecae451eb6a.png


I also tried to add that by default hp recovered is 10% but expanded upon by the luck stat. Did I do that okay?

And say, if Fayhe dies mid battle and resses, and then my 2nd char Lumia dies too, does the variables used here (ResChance/NumRessbattle) interfere? Does she need a seperate variable for her? E.g. NumResBattleFayhe and NumResBattleLumia?

And edit: out of curiosity, why did you add labels?

Original thread: https://forums.rpgmakerweb.com/threads/chance-to-get-back-up-instead-of-k-o-increased-by-luk-stat.123496/