# WindowsBest way to implement RPG elements such as longer actions based on char level?

#### mont266

##### Member
So the inspiration behind this in my game is hugely from RuneScape RPG mechanics.

I want it to take longer for my character to carry out actions based on their level. So an example of this would be in RuneScape, when chopping a tree, it will take longer to cut the tree down if your level is too low.

I'm just curious, what would be the best way to calculate this/work this out in GML?

#### Nidoking

##### Member
There's a whole section of math functions in the Manual.

#### stainedofmind

##### Member
There's no "best way" to do this, however, the simplest solution I can think of off the top of my head is roughly:
Using the tree chopping example, trees will have a "health" value, and for ever second your character spends chopping the tree, remove 1 point of health from the tree equal to you character's level. Boom. Faster tree chopping for higher levels.

#### Yal

##### 🐧 *penguin noises*
GMC Elder
The easiest way to do this is to turn everything into a stat number which is influenced by the level somehow. Higher number --> the thing is done better. You could use the level everywhere, but having separate stats could let you have e.g. equipment that only raises your Woodcutting skill, debuffs that lowers a skill (e.g confusion lowers your Magicka temporarily), and make it easier to display the effective values on the player stat screen.

#### stainedofmind

##### Member
Yal's answer was much more concise then mine. That said, I realized afterward that the method I mentioned above would be horribly flawed, as an increase of just a single point would halve the time. Instead of above, trees should have a "chop time" in seconds, and each point in the stat removes a second of chop time.

#### Yal

##### 🐧 *penguin noises*
GMC Elder
Or even better, value that is being influenced = lerp(worst value, best value, influencing stat / max value a stat can have) ... easy to customize if you figure the worst value is too bad or the best isn't good enough, just change the lerping parameters. And when a stat is decreasing (e.g. time it takes to perform an action), it's much harder to screw up and make it take zero or negative values this way. (Will still happen if the stat goes far enough past the max value, but then again, why even have a max value? You could fix it by clamping the lerp'd value to always lie within the active range for extra stability, though.)