This is my warehouse I created


I also branched a bit away from the tutorial and made a UI counter instead.

Here a little explanation how, although there are probably better ways.
This was the first time I worked with UI and Variables.

I first created a Widget Blueprint and added it to the Viewport.
I also set the Widget BP to a variable for later use.
On the Widget I added a text field and a variable, that automatically sets the text on the text field.

I then grabbed the ammo counter from the widget text, converted it to an integer and made a branch with that.
If the integer value is falsy, so 0 (or not an integer at all) the ammo counter gets set to “Out of Ammo”.
If the integer value is truthy, so above 0, it continued spawning the projectile.

After adding the impulse to the projectile, I made another branch.
For the condition I took the current ammo counter, subtracted one and then checked again:
0 → Set the counter to “Out of Ammo”
Above 0 → Set the counter to the new value.


Privacy & Terms