I have a weapon base class.which is an actor.now I realize that I need a humanoid weapon child that needs to be possessed by AI controller.but the base class is an actor.if I create a child from the weapon base.how do I change it to a pawn?
Pawns already inherit from actors:

And you can change actor’s parent class here:

Thanks,I can’t change the child’s parent.do you mean I should change the base class to a pawn?
Why is that? In BPs specifically an actor can only inherit from one class at a time, though.
I need a humanoid weapon child
Cool phrase…
When you say “humanoid” - do you need a character - pawns are just actors with extra steps, a character class makes handling bipeds a tad easier.
do you mean I should change the base class to a pawn?
If you literally want to possess weapon actors as if they were pawns, that’d work.
I have a weapon base class
Weapons are generally separate entities and attached to possessable actors. But I can easily imagine a scenario where you play as a weapon - in that case it should be either a Pawn or even a Character if you need the anim instances and all.
originally,Most the weapons are guns,cannons.so I made an actor to be the base class at beginning. Now I want to make a robot that can walk around and fire bullet.just like in kingdom rush.it’s the only one”weapon ”that can walk.is it worth to change the base to pawn…?
Yes. If you need AI, then yes.
thanks again… ![]()
why dont you make a robot pawn and just attach a weapon to it so it can fire?
or if for some reason the robot IS a weapon, the weapon could spawn its own pawn if that makes sense.
doesnt seem ideal to change all your weapons to pawns for one use case
Seconded. Even if the setup is basic and non-modular, having a Pawn + Weapon Component (both can inherit) ensures a ton of flexibility. When designing and at run-time.
thanks for advice.basically what I’m trying to do is a tower defense.the whole unit is a tower.the tower includes a tower base (the overall appearance).and different tower base would spawn a specific weapon on it .most weapons are attached on the tower.they could be a single cannon tube ,a person holding a bow,etc.they don’t need to move.so I think they are weapons…
And now I want to make some weapons moveable …here is the problem…they are actors.
there are a lot of solutions here,
-
firstly does it actually need an AI controller, could you just do the logic in an actor component or state tree.
-
could the tower itself be an actor component, and then you can add it to anything
-
similar to above could you just use interfaces
-
possibly the simplest at this point in your development, just have the Weapon spawn a separate Robot Actor
I only want the “Ai move to”feature.I tried to use actor and interpolating location to simulate Ai move to.but I find that’s not as easy as using a pawn with Ai controller.so I was thinking why not change it to a pawn.
and I don’t know state tree.it’s a new concept to me.i guess it’s out of my reach now.
the last solution sounds suitable to me.does that mean the weapon actor should spawn a new pawn?
yep, the weapon can just spawn a pawn.
generally speaking the trick is to try to future proof your game, originally you didn’t plan movement now you do. So try to think what other features you may want and come up with a system that can handle them all
Okay,got it.thanks very much.it’s a very good solution.I can always learn good stuff from here. ![]()