Announcement

Collapse
No announcement yet.

In game currency not updating on hud

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    In game currency not updating on hud

    Hello again... I keep coming back for more!!!

    So what I'm trying to do is implement currency in to my test game.
    What I have is a HUD blueprint with this:
    Click image for larger version

Name:	GetCoinsHUD.JPG
Views:	1
Size:	41.1 KB
ID:	1137579

    In my character blueprint:
    Click image for larger version

Name:	CoinsPAwn.JPG
Views:	1
Size:	27.5 KB
ID:	1137580

    And an actor blueprint that gives the player coins when the character walks in to it.
    Click image for larger version

Name:	CoinsBP.JPG
Views:	1
Size:	49.6 KB
ID:	1137581

    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.
    Click image for larger version

Name:	CoinInGame.JPG
Views:	1
Size:	13.8 KB
ID:	1137586

    What would I need to do to get this working?

    Thanks!

    #2
    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.

    Comment


      #3
      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:
      Click image for larger version

Name:	ammoCharacter.JPG
Views:	1
Size:	28.1 KB
ID:	1053631
      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:
      Click image for larger version

Name:	AmmoHUD.JPG
Views:	1
Size:	102.5 KB
ID:	1053632
      This basically says if the amount of ammo is equal to what ever number then display what ever image.

      Ammo Pickup bp:
      Click image for larger version

Name:	AmmoPickup.JPG
Views:	1
Size:	48.4 KB
ID:	1053634
      This adds 2 to the ammo amount in the character blueprint.

      To show its working:
      Ammo Full:
      Click image for larger version

Name:	AmmoFull.JPG
Views:	1
Size:	12.1 KB
ID:	1053636

      Ammo 3 shots Down:
      Click image for larger version

Name:	Ammo3Down.JPG
Views:	1
Size:	8.2 KB
ID:	1053637

      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.
      Last edited by AutoLiMax; 08-18-2014, 05:50 PM.

      Comment


        #4
        Originally posted by AutoLiMax View Post
        The third picture is a pick up. 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:
        [ATTACH=CONFIG]9173[/ATTACH]
        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:
        [ATTACH=CONFIG]9174[/ATTACH]
        This basically says if the amount of ammo is equal to what ever number then display what ever image.

        Ammo Pickup bp:
        [ATTACH=CONFIG]9176[/ATTACH]
        This adds 2 to the ammo amount in the character blueprint.

        To show its working:
        Ammo Full:
        [ATTACH=CONFIG]9178[/ATTACH]

        Ammo 3 shots Down:
        [ATTACH=CONFIG]9179[/ATTACH]

        So back to the issue....
        Maybe its something I haven't done right 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.

        Comment


          #5
          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:
          Click image for larger version

Name:	CoinsValue50.JPG
Views:	1
Size:	143.6 KB
ID:	1053639

          Here is the HUD bp setting it to display the print string:
          Click image for larger version

Name:	CoinPrint.JPG
Views:	1
Size:	24.5 KB
ID:	1053641

          Here is an image of the print in game:
          Click image for larger version

Name:	CoinsPrintScreen.JPG
Views:	1
Size:	31.4 KB
ID:	1053642

          So something is playing games with me.....

          Any ideas?

          Comment


            #6
            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.

            Comment


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

              Comment


                #8
                MWAHAHAHAHAHAHAHAAAAAAAAAAAAAAAAAA
                Fen thank you. I misread your post. It was the interface. thank you very much.
                Click image for larger version

Name:	get coin.JPG
Views:	1
Size:	25.9 KB
ID:	1053644

                Thanks again!
                Last edited by AutoLiMax; 08-18-2014, 08:34 PM.

                Comment


                  #9
                  Happy it helped you ^^

                  Comment

                  Working...
                  X