Tracking the ammo and eliminated targets

To get our UI to respond to the player interacting with the environment, we will need to modify the Blueprint scripting that controls the player and targets. To begin, let's get the ammo counter to decrease when the player fires a shot from their gun.

Reducing the ammo counter

The Blueprints managing the firing of the player's gun are contained within the FirstPersonCharacter Blueprint. Find this Blueprint within the Blueprints folder of Content Browser and open it. Now find the large series of Blueprint nodes contained within the comment block Spawn projectile. We want to ensure that the counter tracking the player's current ammo count reduces by one, each time the player fires a shot. The Blueprint scripting ...

Get Blueprints Visual Scripting for Unreal Engine now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.