What's the best way to start creating a level up system?

I swear this topic is covered by the Japanese, Chinese and Korean developers on here :stuck_out_tongue: (since RPG’s and MMO’s etc are a huge market over there!)

However it’s a topic that isn’t covered on here (in English anyway). Maybe it’s really easy to do, or maybe no one is developing RPG’s or using RPG mechanics.

I know there are many algorithms out there, however I’ve been wanting to create a level up system similar to Dungeons and Dragons 4th Edition. Even just the basics like gaining experience points until a player levels up is enough of a good starting point.

I’ve got the maths of the system sorted on paper, however it have no idea what to call or communicate across to other classes in blueprint.

Any help and advice is much appreciated on where to start!

Hey, I don’t know if I can be much help but I can try.

The way I would do it in theory is;
Have an AI Parent class (ENEMY) that has an event to cast a value (the value being the exp, maybe have some math to vary the exp gain a little) to the player, I’d then bind the Exp event to an actor destroyed event so that now when ever the AI (Enemy) has been destroyed it will cast the Exp value to the player, then I would get the player to store this and add it to his current exp, then I would have triggers to occur when you get to the certain exp value, these triggers would be the leveling up

Well it really depends how exactly you want to implement it.

For the XP system itself something like TheMunky suggested works fairly well. Though I would create a function for “Get XP” and only provide a value with it while doing any math inside of that function.

Then from the enemy who dies simply call that function and provide a value (or range).

With a levelup function (or a variable “LevelUp Points” or something like that) you can allow the player to select something in some kind of HUD menu which then changes his stats somehow or allows new interaction.

I’m going to make a start with the ideas you guys have thrown at me. I’ll post up what I’ve done in a bit! :slight_smile:

Having issues with image uploads, bare with me!

Enemy Character Blueprint: Give Player Experience Points Function

17776-npc-giveplayerexp-function.jpg

So yeah this is all I have for giving experience to the polayer. I should know this by now. I mean I have made a Blueprint Interface that does hook up this variable. I’m not sure if I should cast or what?

omg i just wrote a massive reply and its just been wiped :’(

Right so here we go again for the comment. I seriously hate this thing sometimes.

So yeah just like a Health system I have tried to create an exp system but I’m stuck on what to do in order to cast the exp points from the deceased enemy to the player.

Character Blueprint Event Graph

17777-pc-levelupsystem-eventgraph.jpg

So here’s my beginplay going into the level up system function.

**Character Blueprint Level Up System Function **

Basically is the currentexp >= level1exp then it levels the player up, if not it sets the current experience points and repeats its check next time points are received.

Enemy Event Graph

This calls the give player exp function upon death before destroying the actor.

Enemy Give player exp function

17776-npc-giveplayerexp-function.jpg

No idea how to cast. Kinda embarassed to post these two nodes. The integer is how much exp the enemy is worth. I have a BP Interface with this hooked up as well but I’m totally stumped.

Sorry if this seems short and snappy. AnswerHub is doing my head in today lol.

No worries! ;D

So I would say you have two ways to do this.

One would be pretty straight forward. “Get Player Controller” (or character. Either one would be fine it just depends where you put the function in and as long as you don’t plan to give the player multiple characters with different levels and exp you can put it into either function. Just remember that if you kill your character with “Destroy Actor” it will reset this).

Anyway. Get that, cast it to your object (“MyController”, or “MyCharacter”), pull out the pin and get your “Levelup System” function.

The other way would be getting your character via the “Damage Causer” pin in your “Event Any Damage”. This would make sure that it works even for AI or different players. Since I assume you use projectiles you would have to save a reference to who shot the projectile directly after it’s spawn and then use this variable as input for “Damage Causer” in your “Apply Damage” node.

So for the benefit of everyone else who reads this thread (I’m all about the sharing is caring!) here is what I have done to put Erasio’s suggestions into practice!

Character Blueprint (Level Up System Function)

Okay, so I had an Exp Recieved variable, so what I did was I hooked it up right at the start of this function, just before the branch and setting it to the Experience Received node on my purple thingy. The actual node is set to zero, however, this node gets filled with whatever number is cast from the enemy when it dies.

Enemy

So I’ve grabbed my player pawn and I’ve cast to my player character blueprint. Whilst casting the player, i have called up the level up system that resides inside the player character blueprint. I have then got the exp value of the enemy (stored in that integer) and have linked it to the Experience Received node.

So if you remember I plugged in the empty Exp Received variable and SET it before the branch, it will now get filled up with whatever number is cast.

My only issue remaining
I don’t players levelling up too easily. I set level 1’s exp cap at 500exp, however I want that to increase as the levels go up. Would I need to make lots of little level Max Level exp variables or is there a better way to do this? I mean at this rate the player would be level 50 in around 5 - 10 minutes haha!

I solved my own issue! This seems to work pretty well! :smiley: Exp is recieved, levels are gained and exp needed is increased with the level!

Check out the comment in the pic for my simple calculation :slight_smile:

Thanks so much for the help guys!

This is great, really nice job,

My XP keeps disappearing every time I kill an enemy? Any ideas? Is it because I am destroying actor? Did you have a similar experience? Thanks in advance!

Where are you storing your XP?

Do you accidentally set your xp (Set XP) instead of just adding the new value?

I got it! I had the wrong variable "Get"er. Thanks for replying