Hello!
Quick run down of my set up before my question…
Player presses E > LineTraceByChannel looking in my custom trace channel of ‘Interactable’ > I break the hit and cast to my base Pickup class > I then cast that to the base weapon class (Pickup_Weapon) class (a child of the base pickup class) > I check a variable named “Weapon Number” set on each child of the Weapon class, so Rifle is set to 0, to match my enum ‘PlayerWeapons’ which lists all possible weapons
Everything is working great, but what I want to do after comparing the weapon number byte with the enum list is to use the Switch to attach the relevant model to the player.
Do I need to have a custom function for each weapon (PickupRifle();, PickupSword();, etc) which handles assigning the correct weapon model, or is there a nicer way to do this that I’m missing? I’m currently using an ‘Add Skeletal Mesh Component’ node to add the model, and the node itself contains the selection for the mesh to add (i.e. there’s no input node to change this with a variable)
Also worth mentioning that eventually I’ll need to do more than just add skMeshes, as weapon specific values will need to be copied across too. Best way to handle this presumably would be by making all of the weapons their own class - would they need to be of component type so they can be added and attached to the player in run time? Additionally, does that mean each weapon would need a pickup class and an equipped class? Because I don’t want to just attach the pickup class as they will have a lot of stuff I don’t want - collisions, unused variables etc.
Here’s my BP:
Thanks in advance, really appreciate your time
EDIT
Here’s my BP pasted on that website…