Download

Character Attribute Logic

Hello all, I am working on a single player top-down turn-based fantasy RPG where the player controls a party of characters. I have the player possessing a camera pawn, which sends information to the characters via blueprint interface. Where I’m running into issues is the logic behind where/how to store character attributes per character. I know that I want all of the characters to have the same classifications of attributes, as in they will all have strength, intelligence, health, etc. However, I want these to be modified based on things like race/class combinations, and increase as they gain levels and equipment.

I am looking for a way where the player presses New Game > Create Character > Select Race (i.e. Human, Elf, etc.) > Select Class > Repeat > Select Party Members > Start Game. I can figure out the most of it, but am very perplexed at how to store a character’s attributes for this purpose.

My question is, what would be the best method for defining and storing a character’s attributes using blueprints? I have looked into using Structs and Data Tables to accomplish this, but am at a bit of a loss.

Any suggestions would be very much appreciated!

So, I haven’t had access to my computer with UE for a couple of days, but I’ve been thinking about this. I’ve come up with a few different scenarios that I think may work:

  1. One blueprint shared by all characters. Basic stats that are used in calculations are stored directly as variables in the character, while others such as race/class modifiers are derived from structs and assigned during construction.
  2. One blueprint shared by the same race/class combination. Basic stats are derived from structs or one large struct, and all race/class specific information is included within the character.
  3. One blueprint shared by all characters. All stats (basic/race/class/etc.) with variables and related functions are all stored as actors, then “attached” to the character to use via blueprint interfaces.

Anyone with RPG or even RTS experience, or are planning on making one at some point, have any pointers or thoughts on this? I know the Character Attribute System exists on the Marketplace, but I’m not exactly at a point where I can put money into this yet, and am also pretty sure not everyone is (especially if this might just be for someone’s hobby). If this type of discussion exists somewhere else already, could someone point me in that direction?

Thanks!
Amsirahc

I believe a combination of #1 and #3 would be the most effective way. I am assuming that all of your characters would have the same set of stats, just different values. Something that I have setup on my characters is that there is a Master_Pawn blueprint which contains the stats (life, mana, intelligence, dexterity, etc) and the functions (health regeneration, stamina use). From the Master_Pawn, I create a Child_Race and each individual child becomes its own race (elf, human, stegosaurus, etc). The Child_Race gets all of the racial bonuses and deficiencies (more mana, triple spike attack, etc) assigned to it. From there, I would have the individual established actors (Fred Rogers, Sammy Davis, Fozzie Bear, etc) as children of their respective races.

So all being said and done, Fozzie Bear would have the triple spike attack of the Stegosaurus race and regenerate its own health, all with no coding in Fozzie Bear’s blueprints because Fozzie Bear is a child of the Child_Stegosaurus and a grandchild of Master_Pawn and would inherit the debts and wealth of its predecessors.

Yggdrasil, that’s interesting, and thanks for the response. I’ve been stumped with this for some time, and this just might help me in the right direction. I haven’t dove into using child blueprints yet, but think I understand the gist of it.

You wouldn’t also happen to have any pointers on how to incorporate the characters into some sort of really basic character creation/selection screen would you? I’m running into issues trying to assign the character’s stats before creation. Of course, I may be completely doing it wrong, and that’s alright, but would love to know any suggestions you might have in that area.

Thanks bunches :slight_smile:

Funny you should mention that…

Video #2.

Hi Amshirahc,

Have you determined how the game stores these attributes for run-time use? Once you determine this, figuring out how to store the data locally with Data Tables & Excel/Open Office Calc or Save Game Objects will be greatly simplified. With local storage in place, its easier to work out remote storage using a plug-in like JSON Query to communicate with a MySQL Server. Both multiplayer and single player games can take advantage of these storage methods. Security and performance should dictate what information you store locally and remotely. I personally use both.

DOWNLOAD RPGAttributeBase.zip (13k)

The RPG Attribute Base is an Abstract BP Class inspired by several Pen & Paper RPG Character Sheets (like GURPS) which can be represented by Tree Data Structure of Keys/Values. All Character/Creature Attributes, Skills, Spells, Weapons and Armor can be represented by a Tree of Key/Values. The Class takes in consideration: 1) Icon images, other media, and logic need to be associated to an Attribute; 2) Attributes need a mechanism to communicate to other Attributes to invoke an self, relative, group, and global events.

[TABLE=“width: 0, align: center”]

https://arcadekomodo.com/home/wp-content/uploads/2015/04/RPGAttribute_Create_Blueprint_based_on_this-150x150.png
https://arcadekomodo.com/home/wp-content/uploads/2015/04/RPGAttribute_Child-150x150.png
https://arcadekomodo.com/home/wp-content/uploads/2015/04/RPGAttribute_Child_Show_Inherited-150x150.png
https://arcadekomodo.com/home/wp-content/uploads/2015/04/RPGAttribute_Relative_Variables-150x150.png

**1. **Create Blueprint based on the RPGAttributeBase

**2. **RPGAttribute Child

**3. **The Child Inherits Vars, Functions, etc from RPGAttribute

**4. **Create hierarchies of Stat Trees, Skill Trees, Magic Trees, Crafting Recipes, etc by *linking *Attributes to other Attributes with the Relative Variables. You could keep it simple, or go complex.

Oh wow, thanks! I’ll have to watch these videos if I get some time this evening or tomorrow. You’ve been a huge help at getting me back on track. To that extent, I say thank you kindly!

Hey TechLord! All of my character’s stats are contained within Structs, and I was just planning on placing them within the Save Game Object for now. The game is going to be designed as an offline single-player turn-based RPG with semi-PnP related mechanics (something similar would be Pool of Radiance: Ruins of Myth Drannor). I’ve taken a look at the RPGAttributeBase before, but it’s been a while and I didn’t quite understand what I was looking at LOL! I’m still learning while doing, and everything I’ve seen up to this point has helped me to understand more and more how things work within the engine. The community has been a huge help so far, and I appreciate each and every one of you! One of my biggest hurdles so far has been figuring out where to start. When I get some time, I’ll sit down and go over all of my current setup and update this thread with the state of things and see if you guys have any input or advice.

Thanks again for all your help!

Hi Amsirahc, I designed RPGAttribute as a Class instead of a Struct for greater flexibility. The thought at the time was dealing with Character Stats, Skills, Magic, and Items as self-contained objects that may require media components and event logic. Another factor is running into issues updating members in an Array of User Defined Structs in previous versions of the engine, I’ve been weary to revisit. No matter how the data is stored (Data Table, Save Game Object, Remote MySQL) it has to assigned to run-time variables for manipulation, a Struct could be used for this purpose. I would say figuring your RPG Ruleset is the first place to start and Character Attributes is part of that.](https://forums.unrealengine.com/showthread.php?71204-FEEDBACK-Advanced-Target-System&highlight=advanced+target)

I completely agree with with the RPG Ruleset as a starting point. It seems like they fixed most of the issues I was running into with updating Structs in previous versions. For all intents and purposes, my Character Attributes (stats) are just a bunch of Floats and Integers at this point, and I don’t see that changing much if at all. I don’t see how I would gain that much using a Class versus a Struct in my case.

hi there, can you give an example of this ? it looks interesting but didnt get the idea of it. a video, ss, anything would be great.