# RPG Expirience Points

### » Thu Jul 29, 2010 11:19 pm

Hello I've just started a basic RPG that is coming along well but I need some help getting started with the Expirience Points (XP) system. I already know how to create private variables for health, mana, energy etc... but I want levels to gradually require more XP after every level up to gain another level. For example to get to level 2 you will need 50 XP, to get to level 3 you will need 75. As the levels go higher more XP will be needed but without a set pattern. I want to be able to have the players level up their character to the max level of 100 but will take awhile to get there. I dont have any complete maps, npcs, quests or skills that will grant XP since I'am just creating the "Engine", I just want to start the XP system then add the options for objects to give XP later on. Sorry if my explanations are confusing.
B
1
G
2
Posts: 5
Reputation: 635

### » Thu Jul 29, 2010 11:36 pm

This is how i would do it, however, I'm sure there is a better way so you might want to wait for more replies .

Anyway, your going to need 3 variables, the players Current Level, his current XP and the amount of XP required to gain the next level.

So obviously, when the player does something that grants XP, you just add whatever amount he gets to the current XP variable, then when the current XP variable is equal or greater than the required XP, increase the players level by 1 and reset the current XP back down to 0.

As for working out how much XP will be needed for each level without having a set pattern, i think you will need to work out a formula that will work for you. For example you might go:

Required XP = Current Level * 10 + 100

This would mean at level 4 you would need 140 XP to get level 5. Or at level 20 you would need 300.

You will obviously want to work out your own formula however.
B
7
S
2
G
4
Posts: 164
Reputation: 2,418

### » Thu Jul 29, 2010 11:54 pm

alrighty thankyou very much. I started with using some different variables for levels and expirience just after I posted my question and got something basic working. You did give me some ideas though. My method will be very tedious to manually set the XP variables for each level.
B
1
G
2
Posts: 5
Reputation: 635