Transforming trick weapons one blueprint or two?

Hi, I’m working on a personal project at the moment and want to create a weapon system pretty much identical to the one seen in Bloodborne. Essentially a button that transforms the weapon from one state to another with a different mesh, moveset and stats. I’ve only recently started using Unreal so I don’t have a full grasp of its capabilities and wanted some advice on different methods of achieving the system I want.

The method that I initially used was to have a structure that contained both the untransformed mesh and combos alongside the transformed ones, then I’d use a boolean called IsWeaponTransformed that would flip flop when an action input was pressed. The weapons normal attack combo had a branch checking for the boolean I mentioned and would assign the transformed combo if true, or the normal combo if false.
The reason I stopped using this method is because it meant doubling all my weapon related code, I would branch every Player action input to check for IsWeaponTransformed and then copy the code assigning the normal attack sequence and reassign it to the transformed attack sequence. I assumed that what I was doing is convoluted so I scrapped it and looked for a better method.

The second method I could think of is to have the transformed weapon and untransformed weapon be two separate blueprints that have a class reference of each other in their structures, this would mean I didn’t have to check for a boolean or reassign animations because both the weapon blueprints would use the same array for their respective normal attack combos. The problem I’m running into with this is trying to access the Weapon details structure of the class reference from the structure so that I can swap the weapons.

Here is a screenshot of the Mainhand Details Structure:

And a screenshot of the node I want to get the transformed blueprints structure reference from.

I get the impression that what I’m trying to do Isn’t very hard I’m just going about it the wrong way, if anyone has any suggestions or any tutorials/documentation that would point me in the right direction I would be grateful. I’m already going through some inventory tutorials because I think they might be relevant to storing class references of actor that are not present in the world.

This is how I do it.

Have one weapon blueprint.

Use a data-table (or whatnot) to store the various states of that BP, your various weapons, their models, stats, etc. There’s nothing fundamentally different about how one gets the weapon to do what it does, they all have light/heavy attack, charge-attack. You only need update the specifics of a the weapon when you slot in a new one.

When you switch-weapons from weapon 1 to 2 (different ones) you would play the put-away-take-out animation and swap the model, load the weapon-BP with your stats from the appropriate table-row.

When you switch weapons from weapon 1a to 1b, it’s the same thing, but instead you play the custom animation 1a references for its’ transform-animation.

I do what you do insofar as your class-setup (1st pic) but also made a distinct-sub-structure for animations specific to the weapon, the run-animation, the draw animation, as well as all the attacks and whatnot; they can all go into your datatable so you can fill in your BP values as you need to.

IMHO anyways…

2 Likes

Thanks, I’m gonna read up on data tables and try using them in the way you’ve described.

I set up a temporary piece of code to see if using the data table would work and It does, thanks again. I’m kind of stumped by how simple that was.