Download

Creating a power system

Hello all,

I want to make a class that i can attach to actors (a Component?)

It will have a few public vars, like power level, max power, spread radius, power generation and push speed. I want to to function by collecting all of the other power components in its spread radius, adding them to a TArray and then when it ticks send out some of its power to them if they are not full. Then, the actor it is attached to will also be drawing power from its Power level.

It was not hard to add as a custom actor derived from AActor that has for example a light component and then the code for the power sending and taking.
Another way i did it was making a AActor with the code, then making a blueprint type of it and adding in the light or door or whatever i wanted this way and coding the rest in blueprint.

What i would ideally like is instead of this being a AActor and making derived blueprint classes is to make this power class a custom component so i can just add it in the blue print editor and have things use it.

I have been working with this for a long time (as you can see from my post history) but no one has been able to give me any solid advice, and i believe this is because i must be confused even after reading documentation of the role of a component vs an actor.

Is the correct way to do what i want to do making the power ‘node’ (what i call them) a AActor like i have then adding components, like lights and things, to them in the blueprint editor? because it wont take long before that is limiting to me.

or is this the ideal situation for creating a custom actor component, a ‘UActorComponent’?

Please tell me if this is unclear so i can try to explain myself better.

well done it is very nice…