Announcement

Collapse
No announcement yet.

floats vs integers for health system

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

    #16
    Originally posted by SE_JonF View Post
    It doesn't seem to be working. I don't know if I may be doing this wrong though. The Damage Player function is in a library, while the regen function is in the character blueprint. Is this the right way to do it, or should I be doing everything in the library? The reason I ask is because the bIsRegenerating is in the third person blueprint, but not the function library. Making a replica doesn't seem to be doing anything.

    Here is the damage player function, which is in the player function library:



    And here is the health regen function in the character blueprint:
    Got it, so you must get, inside the player library, the result of the cast to Third Person Character and pin it to the Object, in the Set Timer By Function Name. That means you are going to call the Health Function from inside the Object reference you are setting, in this case the ThirdPersonCharacter

    Click image for larger version

Name:	forums2.jpg
Views:	1
Size:	217.1 KB
ID:	1107521

    Comment


      #17
      Another detail I forgot to mention:

      Get the same resultant node from the casting character and set its own boolean. Grab the blue pin, unclick in an empty space to open the context menu and type: set is regenerating. Set to false. Thus, you are going to set the reference inside the player, not the boolean inside the playerlib.

      Comment


        #18
        Originally posted by Gbr View Post
        Another detail I forgot to mention:

        Get the same resultant node from the casting character and set its own boolean. Grab the blue pin, unclick in an empty space to open the context menu and type: set is regenerating. Set to false. Thus, you are going to set the reference inside the player, not the boolean inside the playerlib.
        Ok thanks I'll try this. Am I plugging this new boolean into the old spot in the playerlib?


        Ok so I tried both ways, with the old one and the new boolean in that place but still the same result, regen keeps starting immediately after damage is inflicted. =/


        edit 3: It seems to be working, what bugged it out was having an event tick call the function in the third person blueprint while I was calling it in the player library. I think it's working now, thanks a lot for your help Gbr! =)
        Last edited by SE_JonF; 06-01-2016, 01:36 PM.

        Caldera Entertainment | Twitter | ArtStation

        Comment


          #19
          Originally posted by Gbr View Post
          Another detail I forgot to mention:

          Get the same resultant node from the casting character and set its own boolean. Grab the blue pin, unclick in an empty space to open the context menu and type: set is regenerating. Set to false. Thus, you are going to set the reference inside the player, not the boolean inside the playerlib.
          Seems I spoke too soon. This is accomplishing the same result as the delay, which is making the regen wait the time before it applies another + health. Essentially 5 second, + health, 5 second, + health.

          Ok playing around with it, looks like it was due to the way I was adding the health. The timer was looping because the amount was too low, setting it to add max health - health has fixed it. After taking damage and waiting the allotted time, the health will regen to full. =)
          Last edited by SE_JonF; 06-01-2016, 01:52 PM.

          Caldera Entertainment | Twitter | ArtStation

          Comment


            #20
            Originally posted by SE_JonF View Post
            Seems I spoke too soon. This is accomplishing the same result as the delay, which is making the regen wait the time before it applies another + health. Essentially 5 second, + health, 5 second, + health.

            Ok playing around with it, looks like it was due to the way I was adding the health. The timer was looping because the amount was too low, setting it to add max health - health has fixed it. After taking damage and waiting the allotted time, the health will regen to full. =)
            Nice! Hope this solution fits your needs. Good luck on the rest of your project

            Comment


              #21
              Originally posted by Gbr View Post
              Nice! Hope this solution fits your needs. Good luck on the rest of your project
              Thanks! I was tinkering around with it a little more, and was able to eventually get it to delay, and progress smoothly to full hp rather than a sudden jump. Had to play around with an additional timer to get it to work, but I love it now. It's exactly how I wanted. I can't thank you enough for your help on this, it's greatly appreciated! Now onto implementing a similar shield system that prevents damage from affecting the hp while the shield is > 0. That should be fun. =P

              Caldera Entertainment | Twitter | ArtStation

              Comment

              Working...
              X