In the last topic, I was asking 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 increases.
The one I make is just the (basic?) leveling system.
I was hoping that this will help everyone who wants a leveling system .
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 amount of exp needed
Cons: Takes up too much time if you get a massive amount of exp (I happen to get some lag), and the amount of calls is limited (maybe around 180+)
I’m using a lot of *gosub_scene since they are the most efficient way to do things like this (from what I know, for now)
The sub_scene amount will depend on your repetitive command.
If you don’t want to have a lot of .txt, you can write all of them in one sub_scene, give them *label readhere, and you’re good to go.
May this helps anyone in need of a leveling system.
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.
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
I know it’s kind of late, but welcome to the community! And your welcome.
I haven’t encountered one from my research and all of the CoS games I’ve played, besides the demo I’m currently working on. But I haven’t played all of the Choice of Games, Hosted Games, Hearts Choice, and WIP out there, so there might be one or two games that use a leveling system that I don’t know.
Sorry for the late reply tho. I’m checking some of the replies that I haven’t reply yet.
To have an easier formular you could"outsource" the range with a different variable. Ah I mixed up the Modulo part forget that, I will search the right thing tomorrow, my bad
That’s another way to have a leveling system, but as you say, it’s too long to code the whole thing, especially if you want the level not to be capped (like max 100+ levels).
Can you please explain this modulus? I don’t really get what you’re saying, sorry I’m dumb
Okay, but I really don’t know this modulus operator either, I’m not majoring in programming so I don’t know. I search it up and it’s like the program leaves a remainder after a division(?)