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?
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.
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?
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.
$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.