In this step you will be overriding the Grab Events on our GrenadeGunPistol so we can check to see if we want the gun to explode or not when it collides with things.
Right-click in the Event Graph and search for Begin Primary Grab. Select Event Begin Primary Grab to add the node to the Event GRaph.
Repeat this process for:
Event Begin Secondary Grab
Event End Primary Grab
Event End Secondary Grab
For each of these Event nodes, you need to make a call to the same Event in the parent Blueprint to make sure that any existing functionality is still executed. To do this, Right-click the four event nodes you just created and select Add call to parent function.
Connect the Event Nodes to their Parent Nodes.
Click the + button next to Variables in the My Blueprint panel to create a new variable and name it bCanExplode.
If you haven't created a new variable in this session in Unreal Editor, it will automatically be a Bool (the red icon indicates that it is a Bool). However, if you need to change it, select the variable in the My Blueprint tab and then you can change it in the Details panel:
Click + Drag the bCanExplode variable into the Event Graph, and select the Set option.
Duplicate the Set Can Explode node using Ctrl + W and click the checkbox in the new node to set the value of bCanExplode to True.
Finally, connect the Parent nodes to the corresponding Set Can Explode nodes as shown below.
Click the icon in the upper left corner of this image to copy the Blueprint Graph and paste it into your project.
In the Blueprint Editor toolbar, click Compile to update the Blueprint and click Save to preserve your changes.
These sets of Events are called when our gun is grabbed and released. You'll use the bCanExplode variable in the next section of the Blueprint to prevent the gun from exploding in your hand when you punch a robot with it.