Abilities?

Hi. How would you go about cleanly adding an ability that isn’t directly tied to any character? Something that any character who has it marked as their ability can use.

I was thinking of setting up a bunch of bools and branches in the template character to decide which skills it is and isn’t allowed but I figure that might be a little messy and haphazard and it may be better ff having a lone blueprint that carries all of the information on the ability and have it be determined whether or not it can be used in the character’s BP

Looking for something like

Ability: Summon Cakes

and characters with “Summon Cakes” could summon a cake with their ability input while other characters could cause something totally different with each of these effects being swappable in the blueprints

Is there a way to do this or should I stick with the character BP when setting these things up

After creating and working on an Inventory system for the past few months, which ended up extending into an abilities system, I recommend creating and making use of Actor Components.

A simple variation would be having an Ability Component that stores either Classes, Objects, or Structs of predefined Abilities. You can even hotkey 1-4 to the array positions of the abilities in the Ability Component that you attach to your Character Blueprint, or even let an AI use abilities based on the array of ‘known’ Abilities.

If you want to get fancy, like adding a global cooldown so that a player doesn’t spam an ability, or adding a cast time, create a Global Cooldown Component and/or Casting Component. And even farther than that, you can add a Resource Component that could represent Mana - or Health - and only allow the ‘Caster’ cast accordingly.

An Ability system can get quite complex I’ve found @_@

That all sounds like exactly what I need but I’m not sure where to start. Any tutorials?

That’s a very interesting idea which I haven’t thought to do before. Is each ability its own component? For example, if I wanted to add 3 abilities to a character would it need 3 separate actor components?

@BioCoder I think what he’s suggesting is that you create ‘actor component’ blueprints and make your abilities inside of there. Then, add the actor component to your character. Thus, your character can only use the abilities defined in the ‘actor component’ which you added to it.

A spell and/or ability system relies on a few things.

  • A main component to handle spawning the spell actors, keeping track of cooldowns, currently applied auras, and any spells that are owned by the player that are currently in the world.
  • Spell actors that hold the actual scripting, or what the spell should do once it’s in the world.

Spell actors, at least in my case, are based on a base spell class that provides basic functionality of the spells. This includes calling events that can be “hooked” into in the children event graphs. You can even make base classes for different types of spells, such as projectile and aura. The idea is to keep the base classes as generic as possible so you can provide the more specific details in the individual spell actors.

For a spellbook, or list of available spells, you can use an array of BaseSpell class variables that stores which spells you have access to.

I went over this in a stream with BioCoder this morning, where I created a SpellSystem from scratch in a fresh project. It’s not all perfect, I’m no expert with UE4, and I probably made a lot of mistakes in what I said and/or did. I’m unsure on rules for posting links, so if you are interested in watching the recording please PM me and I’ll provide it. I also included in the description for the video a link to the project I made during the stream.

That sounds intriguing, I would love to see that video. I believe there aren’t any rules around posting videos so long as they are relevant to the discussion and not spam/advertising.

It sounds like Sacred 2, that was a complex game with tons of weapon drops, and had a complex spell system of different levels.