Miscellaneous Forums > General Discussion
Need Primary Stat Level Up Increase Formula (FF7)
nfitc1:
--- Quote from: vardahoth on 2017-05-08 17:06:13 ---Also, it's confirmed...
You have an off-by-one error in wall market:
[img]
--- End quote ---
This is known. It's a floating point error when the graph gets high. I've corrected it in the not-yet-released version.
kerihobo:
I see the OP mentions he struggled with Primary stats, but that he had HP/MP working fine... I have the opposite problem. Anyone able to elaborate on a successful HP/MP algorithm? Section 1.4 here is really confusing me... I'd even appreciate some help understanding it...
https://gamefaqs.gamespot.com/pc/130791-final-fantasy-vii/faqs/36775
Here is my specific C# code as I try to replicate it, the main part I am stuck on is the last line I show where I replicate how the guide says to cap the difference to 0-11%... I'm like... 11% of what?
--- Code: ---int lv = 7; // The level we JUST achieved.
int hp = 314; // Our unchanged HP from level 6.
int b = 200; // Base from the current rank curve.
int g = 19; // Gradient from the current rank curve.
void IncrementPointsBase() {
int baseline = b + ((lv - 1) * g);
int difference = Random.Range(1, 8) + (100 * baseline / hp) - 100;
// The guide says to cap the difference between 0% & 11%... of what? The difference? The current HP?
// I really don't understand this particular step.
int cappedDifference = (int)Mathf.Clamp(difference, 0, hp * 0.11f);
--- End code ---
nfitc1:
First of all, that's a two-year old necro. I guess it's relevant so it's acceptable.
Second, don't do any floating point calculations. I'm not sure how it works in C#, but by default in VB.NET it seems to want to do floating point divisions. I have to explicitly state I'm doing integer divisions. This can introduce rounding errors that will build up as you increase the level.
As for the difference, you already have it.
--- Code: --- int difference = Random.Range(1, 8) + (100 * baseline / hp) - 100;
--- End code ---
That value will tell you what you need to know. It should be between 0 and 11, not whatever the .11 you're multiplying it as. Truncate the decimal points from this value and cap it at 11. Then use the HP Stat Gain table to get the HP gain for that level. The calculated percentage multiplied by whatever the curve's gradient is at the level you're moving to.
--- Code: --- int increaseHP = Math.Floor((bonusHP[cappedDifference] * g) / 100);
int newHP = hp + increaseHP;
--- End code ---
Any particular reason you're using Unity to calculate this?
kerihobo:
--- Quote from: nfitc1 on 2019-05-29 17:31:51 ---Any particular reason you're using Unity to calculate this?
--- End quote ---
I was just going over a bunch of my notes from years back and found myself here again. Sorry to reply in a very old thread but I just realized I rudely forgot to reply back then, despite the fact that I made use of what you told me. Thanks! The reason I'm using Unity is cos I'm not working on a mod, I'm slowly rebuilding FF7 in Unity for purely selfish reasons. 5 years and still haven't given up
Navigation
[0] Message Index
[*] Previous page
Go to full version