My Leveling System

Hello guys, this topic is related to my last topic Any ideas on why the leveling system not working?.


In the last topic I was asking on why the leveling system is not working, and the one I want is that in each level progress (level +1) the exp requirement to get to the next level also increase.

The one I make is simply just the (basic?) leveling system.

I was hoping that this will help everyone who wants a leveling system :v:.

And here is the result I’ve worked for the past 24 hours.


Full Code
startup.txt

*create level 1
*create exp 0
*create plusexp 0
*create exprange 1
*create expneed 1
*create totalexp 0
*create ammount 0
*create sp 0

readlevel.txt

*comment here is the leveling code
*label readagain
*if (exp >= expneed)
	*if ((level > 0) and (level < 8))
		*set exprange 1
		*gosub_scene readexp
		*gosub readagain
		*return
	*comment level 10-19
	*if ((level >= 8) and (level < 18))
		*set exprange 2
		*gosub_scene readexp
		*gosub readagain
		*return
	*comment  level 20-29
	*if ((level >= 18) and (level < 28))
		*set exprange 5
		*gosub_scene readexp
		*gosub readagain
		*return

readexp.txt

*comment here is to read if level up
*if (exp >= expneed)
	*set exp -expneed
	*gosub_scene pluslevel
	*return
*else
	*return

pluslevel.txt
*comment here is the +1 level code
*set expneed +exprange
*set level +1
*set ammount +5
*set sp +5
*return

Pros: Easy to use leveling system, you can level up multiple times if you have the ammount of exp needed
Cons: Takes up too much time if you get a massive ammount of exp (I happen to get some lag) and the ammount of call is limited (maybe around 180+)

I’m using alot of *gosub_scene since they are the most efficient way to do things like this (from what I know, for now)

The sub_scene ammount will depend on your repetitive command

If you don’t want to have a lot of .txt you can just write all of them in one sub_scene, just give them *label readhere and you’re good to go.

I know this is not a BIG thing, and I’m still learning. So this may not be a Great things either but may this help :v:.

3 Likes

Make your experience range a formula based on level and you can simplify this enormously. Let’s say XP is 5 times level, e.g. if you’re level 2, you need 10 XP to get to level 3.

After every fight:

*set exp +10
*gosub_scene level_up
level_up.txt

*label level_up

*if (exp >= expneed)
  *set level +1
  *set expneed (level)
  *set expneed *5
  
  You level up to level ${level}!
  
  *goto level_up

*return

The only flaw with this is that you only gain one level at a time. If you gain enough XP to go up two levels at once, you’ll need to wait until you get more XP before you level up a second time. Someone else can come in and figure that one out for me if they’d like. The strength of the code above is that it is simple.

Oh I figured it out! Amended.

4 Likes

Thanks!

And yes, this is a simplier method on the exp range, but someone might want to get the experience range on a calculated base exprange +1 each level when you’re level 1-9, and when you’re level 10-19 you want the exprange +2, and when level 20-29 the exprange +5, and so on.

The code I give is that you can specific on what level the ammount of exprange should be. Maybe it’s alot complicated but that’s it, I can’t seem to find another simplier method than the one I wrote.

And for anyone who might have simplier method than this please help and thanks.

But if you want the expneed just 2 times more or less than the current player’s level, then your code work just fine

thanks for the awesome information.

Are there any hosted games related with a levelling system?or wip even?