# Working on experience RPG system. Stuck in an equation

**159**

Hello,

Im doing a basic level experince system for a game.

At the moment I managed to get the level raise when the player gets X ammount EXP.

Issue is that I want the level to be harder to encount when each level is reached.

At the moment you are level 1 and take level 2 by gaining 5 experince.

To get level 3 you get 5 more experince at the moment.

Easy explanation = You level each 5 exp at the moment.

I want it to be so when you level up the experince need to get like tripple up etc.

So,

level 1 - 2 = 5 exp needed.

level 2 - 3 = 15 exp more exp in total experince.

level 3 - 4 = 45 exp more exp needed in total experince.

And so on. I want it to count from 0 all time and have levels set, harder to get level each level if you know how I mean.

I know there is an easy equation to this since Ive done LUA scripts before with this kind of experince thing but I cannot remember how it was done.

This is what I managed to do so far. It counts well when killing monsters that have experince set to an ammount. Level count good too. Still I want that little fix equation that makes it harder to gain level after each level taken.

Dont need a big SCRIPT written or a huge explanation, only a simple one whats the way to do it. More attributes or what ever needed for this equation to work.

## Comments

159@tatiang Anything you're femilliar with?

12,822This would simply be x3.

159Is it only me or do experince tables in games really work 2x the exp or higher?

I thought you you exp to a certen ammount, gain the level. Then need to take the same ammount of exp + some more since the new level about should be harder to gain?

I mean taking 5 exp all the time makes me gain 1 level each time at the moment.

I dont know how to explain it

I want it to multiply the hardness.

Better example.

level - EXP

1- 0

2 - 100

3 - 200

4 - 400

5 - 800

6 -1600

(this is if the first level is 100exp not as I set it in game to 5 exp)

The experince on the right side is ammount you need to take on new killings to gain next level

11,926I'm having a hard time creating an equation to fit your example but this is somewhat close:

Experience needed for next level equals 5*currentLevel^2

For example:

1-->2 requires 5

2-->3 requires 20

3-->4 requires 45

4-->5 requires 90

5-->6 requires 125

6-->7 requires 180

New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User

12,822Sorry, I don't really understand any of that.

The progression you gave as an example (5 - 15 - 45) is simply x3, if you multiply the last value by 3 you get the next value.

This would be x2 (except for the move from level 1 to level 2, which would be +100)

1,067I created a template a while back for this. http://forums.gamesalad.com/discussion/52494/spare-code-dump-it-here/p23 Havent checked it out in awhile but it should still be relevant. Also has compensation for exp left over.

Follow us: Twitter - Website

159Something like that yes!

Wow thats more advanced then I wanted it to be

I will take some of the code from that thank you man!

89Here is a very complex formula used in the MMORPG RuneScape: http://www.mirekw.com/rs/RSDOnline/Guides/Experience formula.html

Total experience doubles every 7 levels (after level 20 or so), triples every 11 levels, quadruples every 14 levels, and increases almost 10-fold every 23 levels.

Probably more than you need, but it provides a decent starting position.

159thank you!

11,926I read up on quadratic equations (sorry, I love math!) and solved your equation:

XP for next level = 10n^2-20n+15, where n is the current level

So for example, going from level 3 to 4 would be solved by calculating 10

(3)^2 -(20)3+15 = 90-60+15 = 45.Sources: http://www.purplemath.com/modules/nextnumb.htm, http://www.sparknotes.com/math/algebra2/systemsofthreeequations/section1.rhtml

New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User

159haha you really digged yourself into this! Thank you man!!!

159If I add on the player "rule , if player health >= 0 change attrubute exp - 200" Do the exp and level reduce?

159Nvm, I made it so when player die he loses all exp for next level !

thank you for the cool system!