Download

Modular mech weapon system with separate fire buttons

Im working on a Top Down, Twin Stick Mech game. The character mech has four weapon slots (L.Arm, R.Arm, L.Shoulder, R.Shoulder) that I want triggered by the corresponing controller buttons. I set up the character with placeholder Child Actor Components, class assigned at BeginPlay. When I manually selected a class on the SetActor node, I was able to get the triggers to fire the correct weapon. But, when the class is assigned by an Enum Map, the variable is no longer compatible.

My weapon system has a master BP to handle all weapons and ChildBPs for each weapon to set variables. In the character, I was saving the actor reference as a Type MechWeaponSystem (the master BP) so I could Cast to it on AxisEvent for each firing button and trigger the correct weapon.

Ive tried using Event Dispatchers, and even made the master BP a child of the character but, I cant get the weapons to determine that when the button is held that they verify they are in the correct slot to trigger the firing script.

Any advice would be appreciated.

My interpretation is that you have 4 weapons (slots). Each has a key that “sets” that weapon as the one being used. The fire input fires the “set” weapon.

If correct can you post the Enum Map assignment code? This should be pretty straight forward.

Current Attempt to Cast using each Child Actor as Reference. The Weapon class is set in each CA when the mech spawns.

Emun Map takes the selected weapon in player config and assigns the class to the weapon slot. Each Weapon Class is a child of MechWeaponSystem BP

LAWeap -> Get child actor component -> cast

Thank you. It is so easy to miss subtle references in blueprints

No problem.

Get a white board … walk away from the screen … write out the logic.

I have to do this all the ■■■■ time.