Download

How to set up an RPG statistics system?

I’m trying to set up an RPG statistics system where every creature will have a copy of a list of statistics that can be modified for each creature type. Currently, I don’t know where to start so can anyone point me in the right direction as to what to do? Are there any tutorials or articles that can teach me how to set up such a system?

what type of statistics?

Basic things such as armor, health, resistances, etc.

while you wait if someone with more than my two months experience reply (and better english :slight_smile: ). What i would do its create a BP “Creature”, and adding variables like “Armor”, “Health” etc… make public, and adding all code and functions for manager stuff like “Got Hit” → " -X health".

Add mesh component, we call it “Mesh”, and choose one of your creatures mesh

Create a varible type staticsmesh, example “CreatureType” make public too,

In the constructor script use “Set static mesh” to set “Mesh” -> “CreatureType”

Now when you drop that BP in the map, in “Details” (right), you have all your publics variables, health, armor, “CreatureType” etc
You can select what creature mesh want to use, and you can change the value of that variables. Constructor will load that mesh.

then each creature have his own life, armor, mesh, etc and all code for manage “Get Hit” and that things.

that?

I would create an Enumeration for all the types of creatures you’ll have in the game (by name). You can then create a BaseCreature blueprint (Actor blueprint) that runs a custom function in its construction script called something like GenerateCreatureStats (you make this function).

The function would have a Switch On Enum node, and with each item in the list you can do things like SetArmor, SetHealth, SetBlahBlah.

So when you drop the BaseCreature blueprint into the level, there will be a dropdown menu in the item’s properties, and it will have a list of the creature types you made (with all their associated stats). Since you set the function to fire once in the construction script, all stats for all creatures will be generated and assigned one time when you hit play.

After that you can make whatever changes to those stats you want in real time (like you would any normal variable).

Now that 4.2 just released, you might look into Structs too.