Hello,
I’m using a quadratic sequence to apply diminishing returns to the progression system (essentially it means that as you keep progressing, it gets more and more difficult at an unfixed, non-linear rate).
The formula for the quadratic sequence is this:
where n is “reqage” in my code. You read newspapers to become older, and age is a datastore value.
Basically, you need to “age up” using news (a currency).
I want two things to happen.
- The player already has an age. They want to reach another age. Thus, I want to find Tn (the cost in news) for them to age up to this new age.
- A “max” function - finds the maximum amount the user can age up by that they can afford.
Here’s the code for the function that gives you the cost at a specific reqage.
local function calculate(reqage)
local quad = (12.5 * (reqage ^ 2))
local linear = (-12.5 * (reqage))
local constant = 25
return (quad + linear + constant)
end
Any help would be greatly appreciated.