5. Creating the Base Damage Blueprint

This step will cover building the basic Blueprint for having the GrenadeGunPistol deal damage once it collides with the something.

Since you've learned how to make nodes in the previous steps, this section will start to accelerate by grouping creating nodes into chunks. Just remember you can Right-click in the Event Graph to find every node available to the Blueprint, and pulling off a pin will narrow down the context sensitivity of the node search to things that operate on that pin type.

Steps

  1. Create an Event Hit node.

    image alt text

  2. Pull off the Other pin and search for != to create a Not Equals node.

    image alt text

  3. Set the second input pin on the Not Equals node to shell, you'll need to scroll down a ways to find the Blueprint simply called shell.

    image alt text

  4. Next up you'll need to setup a bit of logic using an And node, a Branch node, and the bCanExplode variable.

    image alt text

    There are a number of keyboard shortcuts in the Event Graph, once of which is Hold B + Left Click to create a Branch node, arguably one of the most used logic nodes in Blueprints.

  5. Now you're going to set up how much damage the GrenadeGun will do by getting the Ammo Remaining in the gun, multiplying it by 1000 and adding 1000 to it.

    image alt text

    Ammo Remaining is a variable that is apart of the base pistol class, so you can find it by searching for Get Ammo Remaining. The Multiply node is actually an Int * Float node, and can be found by searching for Int * Float. And finally, the Addition node can be found by searching for Float + Float.

  6. You'll only want the gun to explode once, so you'll need a Do Once node connected to the True pin of the Branch node.

    image alt text

  7. You're going to need a Self node and a Get Player Controller node.

    image alt text

  8. Finally, to do some damage you'll need a Apply Radial Damage node, that will take a bunch of inputs from what you've created and will require some settings changed. Connect it up as shown below. You'll need to change 3 settings on Apply Radial Damage node: Damage Radius, Damage Type Class, and Do Full Damage.

    • Set Damage Radius to 400

    • Set Damage Type Class to Odin Damage Type

    • Set Do Full Damage to True**

    Copy Node Graph

    Click the icon in the upper left corner of this image to copy the Blueprint Graph and paste it into your project.

    You can create Reroute Nodes to clean up your graphs by Double Clicking on any connecting line. As seen above on the yellow line that leads from Hit Location to Origin.

  9. In the Blueprint Editor toolbar, click Compile to update the Blueprint and click Save to preserve your changes.

Results

After this step, you will have a functional weapon that will explode when thrown into the world. It will do more damage based on the ammo left in the magazine, and a fully loaded pistol will do enough damage to kill just about any non-specialized bot. In the next step, you will be adding in sound, VFX, a physics impulse, and clean up the gun after it explodes.