Problem with multiple weapons
I'm having a really weird issue. I have things setup using 2 weapon inventory slots, WeaponEquipped (The held weapon) and WeaponSecondary (One on your back). I have no problems with collecting the weapons and having them fill the correct slots and all is good.
The problems begin when I try to start with a weapon in the Equipped slot. When I spawn the weapon, set it to fill the WeaponEquipped variable and attach it to the socket, it shows up properly. When I pick up a new weapon though, it is no longer sending it to the WeaponSecondary back slot and is adding it to the one in my hand. Here is the node layout for my weapon spawning, which is being handled inside by Character BP:
And I end up with a situation like this:
The weird thing is, if I remove the SpawnActor node and simply do a cast to the Machinegun_BP and keep everything from the Set WeaponEquipped onward, everything works properly but I don't actually have an equipped weapon ingame, just logic that tells the game that the variable is populated.
My pickup, variable assignment and socket attachment logic is as follows:
The first part, the Collect Function, resides inside my Character BP.
The second part, the Overlap Event, is inside my Weapon BP.
For some reason I just can't get this to work. Any ideas?
Hey there Sith,
Let's take a look at the blueprint node "? is valid" in the Collect function, change that over to the blueprint node of "Is Valid" (where "Is Valid" has the green "f" in front of it, not the ?). They both take a object reference, and let's see, if that fixes, by detecting that the passed object doesn't actually exist.
If it still fails in the same fashion, insert one more check after the new Is Valid blueprint node, and that is to get the display name for the object, and check that the length of the returned string is greater than zero. I know I wrote my own "Is Valid" blueprint node, in order to take care of some anomalies with the standard library.
answered Jun 05 '16 at 10:30 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here