Download

How to make an experience tracker for action-based moves?

I’ve looked at some tutorials but they are experience gainers based on killing enemies or time-based.

So, my question is how would I make multiple experience trackers for doing actions - such as sprinting (holding the shift key and counts experience until the stamina runs out), reloading (counts every time the gun is reloaded), after you take a hit for building resistance experience (take a hit of a specific type - sword, fire weapons, hammer). I understand that each of them will need to be variables and then changed by the action, I just don’t know which nodes to use and how in order to make it do what I want it to.

This is just for a personal project to give to a friend because we’ve come up with one of the best rage-inducing games for experienced gamers that isn’t a “difficult” game.

Obviously, I’m pretty n00by at UE4. I started looking into it a couple weeks ago and I’m not someone to take baby steps, unfortunately. So, when you explain I may have a lot of questions.

There are many different ways of doing something like this. One would be just creating separate Custom Events. Or by creating functions to handle all of the experience calculations.

If it was me. I would create a function in the player controller (I would also store the exp variables here too) that takes in two variables. One a float/int (depending on if you want to use decimals or not) and the other variable a enum. The float/int would be the amount of experience. The enum to determine where the experience needs to go. In the function, have a switch on enum node. Then add the exp accordingly.

But that’s just me. Like I said, many ways to do this.

If I understand correctly you have several type of experience points, tied to different bonuses and actions.

Here how I would go about it:

Make an enum of all the Experience types I have.
Make a structure Float, Float, Int (CurrentExperience, MaxExperience, Level)

Make a TMap of Experience Types into your structure.

This gives you a board with all your current experiences amount, properly sorted.

You can then create a function in your character ‘Add Experience Point’ which takes as parameter an Experience Type and an amount.

This goes into the TMap and increases the specified Experience Type. It then checks if we reached Max Experience amount, if so, we increase level, and do whatever we want with experience values (increases max and reset current for instance). You can then call an event ‘On Level Up’ which takes your type of experience and the current level as parameter.

You can then plug anything you want to do when one of the experience type levels up in this event.

You have two ways to call your Add Experience Point function: whenever you press the jump input, you can call it. If it’s a “while an input is pressed” type of experience gain, you can just start / stop a looping timer that proccs the “Add Experience Point” function whenever the player presses or releases its input.

I hope this can help you :slight_smile: