Unreal Engine 4 Blueprinting and Designing: Secondary Fire

Unreal Engine 4 Blueprinting and Designing: Secondary Fire

Creating blueprints or designing a game mechanic might be a challanging task for a beginner, and maybe won’t even be able to start anywhere.  So as a starting place, I have come up with a fairly simple project, that is making a secondary fire for the First Person Shooter template which UE4 provides us with.

Firstly, let’s clarify what we are trying to make. What I have in mind is a heavier metal version of the normal projectile, that makes a lower pitch sound when fired. So, according to that, the things that we have to do are:

  • Create a metallic material for the projectile,
  • Modify the projectile to be larger,
  • Make the projectile’s initial velocity bigger,
  • Create a sound to be played when the projectile is fired, and
  • Modify the character blueprint so that it fires the second projectile when a secondary fire key is pressed (right mouse button).

Making the projectile blueprint

Let’s get started by making the blueprint for the projectile by duplicating the blueprint of the normal shot. I intend this projectile to be heavier, so its impact has to be raised. Also, I want to make it last after it hits something, to give the illusion that it is “more solid”. To do this, I delete the destroy function that was executed after the function that adds the impulse. But how do I raise the impact?

Let’s backtrack from the end. There is a function that adds impulse, and there is an input on it called “Impulse”. That must be the value we are looking for. I also notice that the value going to the input is the velocity of the projectile, times 100. That’s the value we have to change. I had envisioned a shot that was two times as heavy, so let’s make that 200, and delete the destroy function. The result is this:

secprojectilebp.PNG

Looks good to me! So now, let’s make the projectile bigger.

Making the projectile bigger

To make the projectile bigger, let’s select the collision component. We are selecting it because we also have to make the collision bigger, and it contains the sphere mesh so that will be made larger too. And after selecting it, I doubled the scale.

secprojectilecollisioncomp
secprojectilescale

And now our projectile is bigger.

Creating a material for the projectile

So now we are going to make a material. For my material, I am going to make a smoother, more metallic version of the normal material, and I want to make it red. Again, I’m going to duplicate the original and modify that. I have lowered the roughness, and made the metallic value 0.5. I have also made the color a slightly insaturated red.

secprojectilematparams.PNG

The result is this:

secprojectilemat.PNG

It looks pretty good! Now we add it on our blueprint, which I am sure you can do on your own.

Making a sound effect to be played when the projectile is fired

This part is a bit more important because it will be a very big factor in distinguishing between the two shots. Making an effect was fairly easy, I just duplicated the sound effect of the original shot, and modified it to be loader and lower pitch, as so:

lowpitch.PNG

Aaand done. Simple as that.

Combining all the work we’ve done and modifying the character blueprint

Now we do the final step. This part looks a bit complicated, but it really isn’t. I just duplicated all of the parts that had to do with PC controls and pasted them under a bubble. Note that:

  • The “Sound” value of the “Play Sound at Location” is changed to the new sound, not the old one,
  • The “SpawnActor” spawns the new projectile blueprint, not the old one, and
  • The “InputAction” event gets the secondary fire, not the primary fire

Also the blueprint looks a bit different, but only the locations of some functions have changed to make the blueprint more compact.

secprojectilespawn.PNG

Olcay Oransoy

Advertisements

One thought on “Unreal Engine 4 Blueprinting and Designing: Secondary Fire

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s