x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 :P (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!

Product Version: Not Selected
Tags:
more ▼

asked Oct 12 '14 at 11:24 PM in Blueprint Scripting

avatar image

Kagamusha
173 37 33 44

avatar image TheMunky Oct 12 '14 at 11:39 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

more ▼

answered Oct 13 '14 at 08:00 AM

avatar image

Erasio
5.9k 291 86 293

avatar image Kagamusha Oct 13 '14 at 08:54 AM

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! :)

avatar image Kagamusha Oct 13 '14 at 10:54 AM

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

avatar image Kagamusha Oct 13 '14 at 10:55 AM

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 alt text

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

Character Blueprint Level Up System Function alt text 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 alt text This calls the give player exp function upon death before destroying the actor.

Enemy Give player exp function alt text 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.

avatar image Erasio Oct 13 '14 at 03:14 PM

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.

avatar image Kagamusha Oct 14 '14 at 09:49 AM

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) alt text 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 alt text 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!

avatar image Kagamusha Oct 14 '14 at 11:08 AM

I solved my own issue! This seems to work pretty well! :D 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 :)

Thanks so much for the help guys!

alt text

avatar image MaroonersRockAnimation Jan 09 '16 at 11:55 AM

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!

avatar image Erasio Jan 09 '16 at 03:42 PM

Where are you storing your XP?

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

avatar image MaroonersRockAnimation Jan 11 '16 at 04:03 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

This is great, really nice job,

more ▼

answered Jan 08 '16 at 07:27 AM

avatar image

MaroonersRockAnimation
52 2 5 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question