Announcement

Collapse
No announcement yet.

Health bar test, Simple damage via trigger.

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

    #16
    Ok, then the health bar causes the problem ^^ -> could you post a picture of your setup or when it is a bigger bp a video?

    Comment


      #17
      Ok ill post a set of images. but just a question. why does my health got from 100 to -70 then back to 100 when I walk through the fire again?

      Comment


        #18
        Originally posted by AutoLiMax View Post
        Ok ill post a set of images. but just a question. why does my health got from 100 to -70 then back to 100 when I walk through the fire again?
        Actually I dont know why he is doing that (I will have to see your setup)

        Comment


          #19
          I'm just uploading the video. could take a while.... but I hope not

          Comment


            #20
            The video is here:
            It's a little bad quality wise but I have a thread here with screen shots of all my HUD Blueprints: https://forums.unrealengine.com/show...uot-M-quot-key
            The issue I had in that thread is now resolved.

            Comment


              #21
              The problem is in fighters graph^^

              You substract your health from your damage. You have to switch it around, and subtract the damage from your health.

              What it does at the moment is 30(your damage) - 100 (Heath) = -70.
              If you walk through it again it does 30 - (-)70 = 100.

              Comment


                #22
                ahh thats made it go from 100 to 70 to 40 to 10 but then it goes to -20, so the my character isn't dying. and also the health bar still remains the same.

                Comment


                  #23
                  I added a clamp so that the health doesn't go below 0 or over 100.
                  Click image for larger version

Name:	clamp.JPG
Views:	1
Size:	38.2 KB
ID:	1053320

                  Comment


                    #24
                    As I said, the standard implementation has no real health implementation. If you want your character to die, you have to do it yourself. Disable Input, Enable Ragdoll, let him explode or whatever your prefered reaction to death is in your game :P

                    Well, but that shouldn't affect your health bar. I guess there is some other problem that is causing the issue.

                    I am not sure, but it might be the function GetPlayerHealth() in your HUD that is not returning the right health, but well. You should really learn to debug your code. It's a nice skill to have
                    So basically you follow your code flow and check where things could possibly go wrong. Then you investigate it bit by bit (either through prints or breakpoints) until you found the issue.
                    Last edited by DennyR; 08-08-2014, 03:17 PM.

                    Comment


                      #25
                      Thanks DennyR, I'm attempting to get my player to die at 0 health now, then I'm going to dig through the HUD BP to see if I can sort it out.
                      If I figure it out ill post back.
                      If somebody else thinks they know what the issue is then don't hesitate to tell me what for

                      Thanks

                      Comment


                        #26
                        I think I figured out why the health bar isn't working. Its because I need a parameter in the health bar material.
                        Click image for larger version

Name:	healthparam.JPG
Views:	1
Size:	15.0 KB
ID:	1053322

                        Comment


                          #27
                          Ok! I've sorted it. I checked the content example HUD and everything was perfect and for some reason it didn't work, so I went for a different approach.
                          It may not be the best way but it works and that's fine with me for now.

                          In MyCharacter/Pawn Blueprint:
                          Click image for larger version

Name:	HealthDeathSetup.JPG
Views:	1
Size:	91.1 KB
ID:	1053340
                          This sets that pawns health, sets a condition that says when the health reaches 0 simulate the player physics (ragdoll which was ticked components tab) and then it loads the level again after a 5 second delay.
                          I've left the print health there for my own sake.

                          -if there's a better way of doing this please let me know.

                          In my HUD Blueprint I have this:
                          Click image for larger version

Name:	HUDBP1.JPG
Views:	1
Size:	116.1 KB
ID:	1053341
                          Click image for larger version

Name:	HUDBP2.JPG
Views:	1
Size:	129.1 KB
ID:	1053342
                          It basically draws the texture based on a condition which if met then it displays the correct texture.
                          If i had done it using flash and scaleform then i would have probably set it to go to a specific frame based on the health.

                          Example of textures:
                          Click image for larger version

Name:	100.png
Views:	1
Size:	16.2 KB
ID:	1053343 Health at 100

                          Click image for larger version

Name:	65.png
Views:	1
Size:	16.2 KB
ID:	1053345 Health at 65

                          Click image for larger version

Name:	15.png
Views:	1
Size:	16.2 KB
ID:	1053346 Health at 15

                          This health bar is similar to that of Assassins Creed or Zelda, unlike the content example which is more like an RPG/MMO health bar.

                          Screen shot of it working:
                          Click image for larger version

Name:	ScreenShot.JPG
Views:	1
Size:	173.0 KB
ID:	1053347

                          Thanks for the help!

                          Now I need to figure out how to get the character to spawn at a check point after death but for now this will do.
                          Attached Files
                          Last edited by AutoLiMax; 08-09-2014, 02:31 PM.

                          Comment


                            #28
                            Originally posted by AutoLiMax View Post
                            Now I need to figure out how to get the character to spawn at a check point after death but for now this will do.
                            Here is a tutorial: https://www.youtube.com/watch?v=BD-QTsMtxno

                            Comment


                              #29
                              Thanks a lot dude!

                              Comment

                              Working...
                              X