Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Blueprints Visual Scripting for Unreal engine

You're reading from   Blueprints Visual Scripting for Unreal engine Build professional 3D games with Unreal Engine 4's Visual Scripting system

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher Packt
ISBN-13 9781785286018
Length 188 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Brenden Sewell Brenden Sewell
Author Profile Icon Brenden Sewell
Brenden Sewell
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

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 required to do so looks like this:

Reducing the ammo counter

Find the final node in the chain, Play Sound at Location. Drag a wire from the output execution pin of this node to empty grid space, and add a Set Player Current Ammo node. Then drag a wire from...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime