RPG like abilities system

Hello,

I’m working on a small prototype of a RPG like game and I’ve have some question about implementing an abilities system.

So far I have an interface BPI_Ability. This interface contains just one function “ExecuteCommand”. Also I have a blueprint BP_AbilityBase. This blueprint defines some variables like castTime and so on. BP_AbilityAttack inheritance from BP_Ability. Here I’ve implemented the ExecutiveCommand function. This works fine, but here is my problem. I also have a BP_Monster blueprint and this BP contains an Array of BP_AbilityBase. The main idea was, to put or add the ability to that array, so the player can choose which ability should the monster be able to use. Something like a Pokemon learning an attack. But the problem is, I have no idea how to generate or “instance” this abilities without “Spawn Actor” function. But I don’t really need this, because the ability itself is just data and do not contains any static meshes or models.

What I need or desire to achieve, is a pool of abilities like BP_AbilityAttackFireball or BP_AbilityHealGroup etc. where I can set the members and than add it to a pool of abilities of my monster.

I hope my text makes any sense, because English is definitely not my best part :smiley:

Thanks in advance!

Maybe you are looking for something like this.

	static ConstructorHelpers::FObjectFinder<UBlueprint> PlayerPawnObject(TEXT("/Game/Blueprints/MyChar"));
	if (PlayerPawnObject.Object != NULL)
	{
		DefaultPawnClass = (UClass*)PlayerPawnObject.Object->GeneratedClass;
	}

Hello Crazylawn,

If you’re interested. I would like to get in contact with you about finding a solution. I’m aware of this problem, and this has been up in discussion for sometime. Someone else wanted to do this with tanks shells. Similar to your abilities required to be modified then added to the stack to be used.

PM me on the forums https://forums.unrealengine.com/member.php?1071-SilentX and I’ll make your goal possible.

Peace

Hi LPUnreal,

thank you for the help. Unfortunately, I’m working with blueprints at the moment and I’ve hoped, such system is realizable without C++.

Are you capable of a little bit of c++? Here’s why. There was a recent post on using excel for data driven games, and this is the perfect use of such a feature. You are right that you could use a struct. There is a very small amount of c++ involved to expose the row object, but once that is done, you could populate a struct of abilities, and associate animations, status effects, and just about anything you need. Then you can place this array on the player pawns and give them to your game mode and HUD for rendering GUI and game logic.

Hi joessu,

C++ isn’t a problem. Just wondering that it’s not really possible with blueprints, but I’m grateful for any help.

At this time, I don’t believe its possible. I do however want to make it possible for BP. As he also stated, Data-Driven skills would be the best way to implement any RPG skill system. But that is an extended use of the solution you would need to created.

You don’t have to add THAT much C++, in fact, very little. Just enough to expose the Row object to blueprints. You can reparent your existing blueprints to a class that refers to them.

In fact, if you want to prove that this in fact is a workable solution, replace the C++ statement i made with a couple of hardcoded blueprint structs filled with data. see if you can pass them around like i said and if you find success in that, get excel involved.

Hi,

sorry for delayed answer, I was pretty busy and haven’t log in for awhile here. Thank you for the tip. I will try it! :slight_smile:

I made my skills/abilities Actor Components that I attach to the monsters/player. I don’t know if that’s the best way but shoot, it works.

I also think I might change that if it turns out clunky to an array of Bools that determine what they have learned/haven’t learned. Another thought.

Hey, I tried something similar.

I am working on an RTS-Type template and thought about a system to give different units of class “Unit” different skills.

Instead of coding all the skills in the particular “Unit” i wanted to do a main class “Skill” and child classes of it like “Skill_SelfDestroy” or “Skill_Sprint”.

Then back in the “Unit” class i wanted to set an struct array whereas the struct contains a “Key” and a class of “Skill”.

For example at index 0 → “X”; “Skill_SelfDestroy”.

So at any KeyPress I check the struct array for an equal “Key” and get the “Skill” class.
The problem then is, that i cant really call a class. i would have to spawn or constrct it first and call the Reference which feels a bit clumpy.

Also im not sure which class i should use as Parent class of “Skill”.
“Actor” seems overkill, i tried “Object” but this does have to much limitations like it cant use Function Libraries and does not have any Tick events. I tried “Actor Component” aswell but i cant spawn them at runtime…

I tried a lot and all I know by now is what does not work. sigh

I imagine your array is of type BP_AbilityBase reference (blue)
i didnt try this, but i imagine what you are looking for is to change the type to BP_AbilityBase class reference (purple).
to do this, when you choose the type of the array, click the small arrow next to the type and choose class reference from the drop down menu. this will let you save the class definition of the BP_AbilityBase