In game currency not updating on hud

Hello again… I keep coming back for more!!! :stuck_out_tongue:

So what I’m trying to do is implement currency in to my test game.
What I have is a HUD blueprint with this:

In my character blueprint:
720698e7fd72fdd5c5d685545c25c7c66ad902de.jpeg

And an actor blueprint that gives the player coins when the character walks in to it.

When my character walks in to the actor it disappears but the the coins do not update on the HUD it just stays at 0.0.
Also if I set the coin variable to the default of 50, the coin value on the HUD still stays at 0.0.
CoinInGame.JPG

What would I need to do to get this working?

Thanks!

Your third picture looks rather weird to me.

My advice: make a function inside your MyCharacter blueprint and call it AddCoins. Then add a input to that function that tells you how many coins you want to add. So you can handle the coin logic inside of your character.

Then in your CoinActor just call the function OnOverlap. This should be a lot cleaner and should work.

The third picture is a pick up. It doesn’t really have anything to do with the problem because if I set the default coin value in the character BP to 50 it still shows as 0.0.
I have used the same method with ammo and it works fine and updates it on the HUD. The difference with the ammo is that it displays an image based on the amount of ammo left. where as with the coins I want it to show a number, not an image.

This is how I’ve implemented my ammo.
Character bp:
ammoCharacter.JPG
It pretty much says that the maximum ammo for the weapon is 10 and the minimum is 0.
The weapon can only shoot if it has more than 0 ammo which is set with the branch condition.
Each shot costs 1.

HUD bp:


This basically says if the amount of ammo is equal to what ever number then display what ever image.

Ammo Pickup bp:


This adds 2 to the ammo amount in the character blueprint.

To show its working:
Ammo Full:
AmmoFull.JPG

Ammo 3 shots Down:
Ammo3Down.JPG

So back to the issue…
Maybe its something I haven’t done correctly in the HUD blueprint? Because Even if I completely ignore the coin pick up and set the coin variable to 50 in the character blueprint it still doesn’t show 50 on the HUD in game.
It shows 0.0.

So its the HUD not showing the correct value from the character bp.

First check to see if your coin value is actually working by printing it to the console. If that doesn’t work, initialize the coin value using your construction script. I had a similar problem earlier and it was solved using that.

Hmm I tried what you said but even when the value get shown using the print string it still only shows up as 0.0
Here is the coin variable being set as 50 in the construction script:

Here is the HUD bp setting it to display the print string:
CoinPrint.JPG

Here is an image of the print in game:

So something is playing games with me… :frowning:

Any ideas?

Hello,
you haven’t show your interface. have you check that both coin and ammo are equivalent in their settings ? As you print in hud lmaybe var is ok hud is ok but interface have a trouble.

Both ammo and and coin interface event functions are the same. They both have a float output.
Hmmmm this is very confusing! :frowning:

MWAHAHAHAHAHAHAHAAAAAAAAAAAAAAAAAA
Fen thank you. I misread your post. It was the interface. thank you very much.
6798e1097e4ea8856e3cce7676879f092d646d3a.jpeg

Thanks again!

Happy it helped you ^^