Changing an actor type

Hey Everyone, I’m mostly messing around with some prototyping for some possible gameplay. I’m trying to find a way to make npc’s “change class” sort of.

Right now, i’ve got a handful of blueprints, that are all, basically the same, except for the mesh and animation set, but will hopefully, eventually, be much more complex (available functions, and behaviors available, etc) so, for example, the game starts with a commoner, and as time goes by, it is supposed to be come a priest, how is the best way to go about making that happen? It seems like casting is supposed to be for short term use, not permanent. Is it better to create a new actor, taking the information I need from the existing one to fill in the info (like, the person’s name), and then deleting the old actor, and replacing it with a “new” actor of the correct blueprint class?

I am not for sure, I completely understand, how you are thinking. But will put in a scenerio, and ask questions, along the way

Character/Blueprint/Whatever

Starts as X, and now needs to become Y. Ok, but what needs to become Y? The visual aspect? the game play aspect? Neither of these I could see a reason to need to change a “class”, i.e. why go through the processing required to do that? To change the visual, I’m assuming you have been using some form of Static Mesh, or Skeletal Mesh, etc to hang the clothes off of, So to change the visual, Just set the Mesh material and your done, walla, no Class change, no new “creation”, blam, new static mesh, new look, The same with gameplay, set a variable, as to function/feature set the Character can now use, and get after it.

But is a “class” going to help on this? Doubtful, unless the character is changing from some form of actor, and is now going to be a “vehicle”, even then i’m not sure that switching would be the answer, as possessing the vehicle seems more like what would need to be done.

Anyway, just some thoughts, and certainly not trying to tell you what to do.

You mean if your character levels up and gets new skills?

Depending on how you’ve setup your project, you might achieve some of this by adding new components as you go along. So your commoner could gain the skills (such as blessing other characters, or having better charisma) that make him a priest. You’d still have to change the look at the same time.

But if your character completely changes (not just new skills, but possibly replacing old ones; visual changes; different AnimBlueprint), you might be better off replacing the character and letting the Controller possess the new pawn. (In that case, you might consider storing persistent information either directly in the Controller or in a Component that handles copying itself to the new pawn.) This might get messy to look right, but if the model and animation changes you have that problem anyway.

Adding or replacing components is more flexible if your NPCs could level up in different directions. For example, one becomes a priest, another becomes a warrior, and a third one becomes a priest who’s also a warrior. In that case you’d have a PriestSkills component and a WarriorSkills component (highly simplifying things, of course) and whatever components an NPC has defines what they are and what they can do.

If you only have clear upgrade paths, on the other hand, and you don’t need any information about what the NPC used to be, replacing the Pawn seems easier. That way, you can always access an NPC’s current profession and skills without having to worry about what other skills they also might have.

I’m sorry I can’t give you a definite answer because it really depends.

Her ,

The current concept is to have a relatively linear path of branching upgrades. So let’s say I’ve got 2 people. They both start as a commoner, due to “factors” one becomes a farmer and one becomes a fisherman. They are each able to do specific things (build certain structures) and make requests to you as the player. While changing back to an old template might be possible I don’t think it’s going to have any effect as far as needing to remember it. There won’t be such thing as a “level 1 commoner” and a “level 15 commoner” either you’re a commoner or you’re a priest or you’re something… any advancement would be into a new template (I think)

That sounds like you’ll want to replace the pawns, yes. Even if your priest decides to become a fisherman after all, you can simply replace the priest pawn with the fisherman pawn and everything works fine. (Of course, if you want an NPC to be both a fisherman and a priest, you’ll have to create a new actor specifically for that.)