Not sure what I am doing wrong here or why it isn’t working but I have a sword BP that the main player can pick up and equip. What I want to happen is as soon as the player has the sword the sword in the game map disappears as if the player picked it up. In the sword BP I set when the player picked up the sword and then on an event tick branched true when sword was picked up to destroy the sword after a slight delay but it doesn’t work for some reason. Can anyone see where I am going wrong with the below BP or even have a better way of doing this?
Is the sword component a solid object? If so, use the OnComponentHit Event instead of the OnComponentBeginOverlap Event.
Also, if you have the Level Editor and the Event Graph open at the same time (with 1 monitor, shrink both windows so one takes up the top-half of the screen and the other the bottom-half) you can see in the Event Graph which Nodes are firing while you simulate the game. That way you can isolate the problem and determine if the collision event is even firing, if the problem is happening with the cast, etc.
Why the Tick Event? Just call the Delay + Destroy where you currently set the boolean to true.
Also how do you actually equip the weapon, because if you destroy the actor, it’s gone. Are you only getting the Sword Mesh and give that the player or what are you doing there?
(Just want to save you from referencing the Sword actor while also destroying it, which wouldn’t work.)
Also is that a Singleplayer or Multiplayer game?
It is solid but it didn’t work probably because I checked and this part of the BP isn’t doing anything.
Its a single player game. I thought the OnComponentBeginOverlap was telling the game when the player was equipping the sword but it wasn’t doing anything. Instead I set up a bool in the main player character to tell the game when the player has the sword.
Which now works when I set this in the sword BP.
but that is doing what you said it would which is destroying both the equipped and unequipped sword. Not sure what to do from here.
Instead of spawning a new one, just use the one you overlap.
Create an event/function in your player that has this weapon as an input and then pass it and attach it on overlap.
I’ll try that thanks.
So I took and amended a weapon BP pickup I had for VR controllers and it works perfectly for picking up stuff with my right hand but…
I thought to get it to work with the left hand would be as simple as replicating those functions for the left hand but when it came to the OnRep_EquippedWeapon that seemed to override the OnRep_EquippedWeaponleft I created. Even when I deleted OnRep_EquippedWeapon, OnRep_EquippedWeaponleft wouldn’t work even though it was exactly the same BP just with left at the end of its name so something in the other functions is making sure OnRep_EquippedWeapon will only work. Can you see any other way I can get the left hand pickup to work?