Download

Easiest way to go about making heroes

How would I go about making heroes easily creatable for designers? I want to make a base hero class. Then the designer can be in the editor and find that base hero class as a blueprint or something and start making heroes from there, settings stats, meshes, etc. But I also want to be able to reference these heroes made in the editor from C++. Is this possible?

This is an entirely vague question. So I can only give a very vague response.

But essentially you would have to setup your class inside C++, and use the UPROPERTY() macro to setup your variables to be editable inside the editor. You would create your class “Hero” and then give it your variables, such as health like so:



UPROPERTY(EditDefaultsOnly,Category = "Stats")
int32 Health; 


and now some one in the editor can create a blueprint off of Hero, and name it “Bob’s Hero” and set their health stat inside the editor.

To reference the BP to C++ is tricky, easiest way to do this is to setup another variable with UPROPERTY() that is of your hero type. so



UPROPERTY(EditAnywhere,Category = "Hero Blueprints")
TSubclassOf<class AHero> HeroBP


now you use the editor to put a reference into that variable, and when you use your code you can use that HeroBP variable and it’ll use that BP info when spawning, and etc.

Thanks. That’s pretty much what I was looking for I think. Just trying to make a base hero that has the stats, set of abilities, basic attacks, etc. I want to make it so that my friend can make heroes, abilities, items, monsters very easily without using code. But I want to still use code and let my friend be able to do work when I’m working on coding things like game mode, AI, other various things to implement in the BP.

The way I looked at it was I would have a base hero. Logic would be done in code and all that’s done in the blueprint is the numbers. So like saying an attack does 20 damage and that attack uses animation attack1. Max health, etc. Then for abilities I would have it set up to take something like a component to add functionality. I would again code out the basics of it but they put all the variables, how fast it moves, how big, colour, fx, etc. Then to the ability itself add things like buff player, buff target(whoever is hit), damage and other things like that.

I’m not sure if this is more detailed like you wanted or if this is a good way to go about using blueprints.

That’s exactly what Blueprints are great for. Coding it in C++ and exposing it to Blueprint like that is a perfectly legitimate way of going about this allowing non-programmers easy access to creating great variations without giving them anything that can break the game.

Ontop of that, if you go into your class header you’ll see an “UCLASS()” portion. By adding “abstract” you’ll give people using the editor access to the class ,but you’ll remove the main class from being modified or used in-game. So everything has to be a subclass.




UCLASS(abstract)
yourclass :: public parentclass blah blah blah stuff here


Thanks for that. I’ve gotten to the point of creating a basic character/hero and in the editor their values can be edited and they can be given abilities. But for abilities I was thinking of breaking things up. Such as is the ability an instant effect, projectile, raycast, aoe, cone, etc etc. But then based on that it can apply other things. Like if the raycast, projectile, etc hit someone it can apply a debuff or buff. But then what if I want an ability that applies multiple of these effects. So say it heals the player using it and the player that is hit. I would need to add two effects for that. Would I be able to give designers a way that in the editor they can add multiple effects without limit?

So here’s a poor diagram.



   [Frostbolt]       --->    [Projectile]   --->     [Slow]
Ability Command               Effect                Behavior


So the projectile would check to see if it hits an object(wall, player, npc, etc etc) and if it’s an object flagged as taking damage it’ll apply damage and it’ll do a check to see if it can have behaviors applied to it as well. Which if it does it looks at the behavior and applies the behavior.



  [Earthquake]   --->  [Earthquake Set]   --->  [AOE]
                                        |--------->   [Aura]   --->  [Slow]


So here I would want an ability Earthquake to cause damage in an AoE around the player and deal initial damage. Then an aura that checks within a set time frame. For any players within the aura if they are flagged they take damage and are applied a behavior called slow. This is an example of a single ability having multiple effects to make it easier for designers to make abilities.

So I know how to make all the individual things. I’m pretty sure I can go about that myself. But the part I’m not sure about is how to allow create a set for the editor. Something that will allow designers to add multiple effects to a single ability and keep track of everything attached easily.