In need of some advice for this gun system I'm trying to make

I’m currently teaching myself how to go about making a gun system. So far I’ve been able to make pick up logic, make different weapons shoot, do damage, have different fire rates, and have a basic weapon swap system working using arrays. But I’ve come across a roadblock and I can’t seem to find a workaround for it yet. I’m trying to implement a “mod” feature where each gun has their own respective modification that the player can use on it.

For example: a pistol has mods like dual wielding and explosive rounds whereas the assault rifle does not. But the Assault rifle has mods like an advanced scope and automatic shotgun rounds but the pistol does not.

For how the player will go about obtaining these mods, I’ll be reusing the pick up logic I already have and I figured as far as storing goes I could use another array system for that? I’m not 100% on if that’s the right way to go about it or not. But I want the players to be able to select the mod they want for the current weapon they’re holding and then utilize the mod upon triggering.

What would be some good ways to go about doing this?

(Using 5.5.4 if that’s any help)

Easiest thing to do would be to create an enumerator for weapon_type. and use it for a var on the weapons and mods. Then when you try to use a mod, get the weapon_type for selected/current weapon and see if it matches the mod’s. For mods that work on more than one weapon type, you could use an array version of the var and check if the array contains selected weapon type when you use it. This could be handy for something like scopes that might work on any long gun.

Ok, I got a question for “use it for a variable on the weapons and mods”. I believe I got most of what you were saying but just for clarification, what I took away from your response was I would make two enumerator lists (weapon and mod) and make a variable for them in their respected base blueprint so they carry over into the child blueprints. I would then use the drop down and select the right enumeration for each child blueprint? How would I go about making sure that the enum mod variable is accounted for with its specific weapon? Would that be something I do inside of the weapon child blueprint or the player character blueprint?

For this specifically, I’m just aiming for loyal mods. None of the mods will work on more than one weapon type. But I’ll definitely keep noted that an array system for mods on multiple weapons can work.

Sorry, I meant to use the same enum as a variable for each class, then you can just use equal(enum) node to compare.

So, for instance, both a pistol and a dual wield mod might both be set to weapon_type: pistol, and the mod would work when it got true result from weapon_type = pistol check.

I’d probably put most of the logic in the mod classes and call it via interface from the player char so each child of mods can have their own implementation and results can pass directly back to player without a bunch of casting.