Custom character derive from Custom pawn (c++ or bp)

Hi everyone!

Is it possible to create a custom character which derives from a custom pawn?

Like i have an APawn and an ACharacter,i want to make this ACharacter to have the variables from the APawn somehow.

This would be for an RPG setup, like HP,XP,Level.
All of the enemies would be a Pawn but a player is a Character, but i want to use them the same way, how is it possible?

Thanks!!!

Hi Baki,

Is it possible to create a custom
character which derives from a custom
pawn?

Not sure that I correctly understand you. If you mean:

class CustomCharacter : public ACharacter, public CustomPawn

,then it is not possible. But ACharater is derived from APawn. You should to create two classes (for player and for enemies) derived from your custom character.

Cheers,

Sorry for the confusing question, i would like to use the same parent class for my pawns and my character. So i would like to extend the Pawn class with my MyPawn class, then somehow extend the MyCharacter from a Character class which extends MyPawn insted of the default Pawn class.

So i want to change this:
Object > Actor > Pawn > Character
To this:
Object > Actor > MyPawn > MyCharacter

I really appreciate your help!

I see what you are talking about now. No, it is not possible. You cannot change parent class of Character.

Like an option, try to create MyCharacter derived from Character and implement common functionality for your enemies and player. And then create classes MyCharacter>MyEnemy ; MyCharacter>MyPlayer.

In addition, you can use interfaces to implement common methods for different types. If you would like to know a little more about interfaces, please take a look at the post below. A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums

Hope that helps!