Announcement

Collapse
No announcement yet.

HP

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

    HP

    I'm quite new to unreal engine. I can't figure out how to make my HP go down every frame. here's a picture of what I have so far.

    #2
    You need to have "Set HP" after the Tick as well. Currently, your HP is only set to 1000 at the beginning of the level, as there is no orders to Set it to anything after each tick.
    To make HP fall down gradually in that fashion, you need also to have "Tick"-> "Set HP" and then connect that to "integer -" , where "Get HP" is at top and -1 is at bottom.
    Erm, so , copy that Set HP you have on the left, and paste it before the print string on the right, and connect it to the tick.
    Last edited by Manatee; 06-18-2018, 01:33 AM.

    Comment


      #3
      And use Timers instead Tick on actions like this one.

      Comment


        #4
        Originally posted by Porshe911 View Post
        And use Timers instead Tick on actions like this one.
        Beat me to it. Yeah, it's a horrible idea to put something like this on tick. Always use timers or delta time for things like this.

        If you don't want to use timers, then take the world delta time and come up with a rate of HP loss per second. If you wanted to lose 10hp per second, you'd simple have the equation 10*deltaT. That would calculate exactly how much hp should be removed from frame to frame. If the time between your frames was 100ms, you'd have 10*0.1=1hp, if it were 10ms, you'd have 10*0.01=0.1hp, and so on. Regardless of the frame time, it would remove exactly 10 health per 1 second.

        Always make things like this frame rate independent.

        Comment


          #5
          Originally posted by IronicParadox View Post

          Beat me to it. Yeah, it's a horrible idea to put something like this on tick. Always use timers or delta time for things like this.

          If you don't want to use timers, then take the world delta time and come up with a rate of HP loss per second. If you wanted to lose 10hp per second, you'd simple have the equation 10*deltaT. That would calculate exactly how much hp should be removed from frame to frame. If the time between your frames was 100ms, you'd have 10*0.1=1hp, if it were 10ms, you'd have 10*0.01=0.1hp, and so on. Regardless of the frame time, it would remove exactly 10 health per 1 second.

          Always make things like this frame rate independent.
          great thanks.

          Comment

          Working...
          X