• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Unit's hp regen per second?

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,348
I don't think so. You'd need to do the maths yourself I suppose. Something like this:

Base HP regen + (Strength Amount x (HP regen per strength stat)) + Items + Abilities

This could be complicated to work out depending on items and abilities/aura that affect HP regen.

There is an easy but dodgy way of automatically calculating Hp regen, but it wouldn't work under most circumstances. Here's the code:

  • Regen Amount
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of HpRegenTestUnit) Equal to (Max life of HpRegenTestUnit)
        • Then - Actions
          • Game - Display to (All players) for 1.00 seconds the text: Cannot caluclate HP...
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HasInitialHpBeenSet Equal to False
            • Then - Actions
              • Set HpRegenAmount = (Life of HpRegenTestUnit)
              • Set HasInitialHpBeenSet = True
            • Else - Actions
              • Set HpRegenAmount = ((Life of HpRegenTestUnit) - HpRegenAmount)
              • Game - Display to (All players) for 1.00 seconds the text: (HpRegenAmount: + (String(HpRegenAmount)))
              • -------- reset --------
              • Set HpRegenAmount = (Life of HpRegenTestUnit)
HpRegenTestUnit - The unit your testing
HpRegenAmount - A real. This value calculates Hp Regen Rate. You'd need to save this into a separate variable before it's reset
HasInititalHpBeenSet - A boolean.

This would only work if the unit has lost more life than what he regenerates per second and the value takes 1 second to update meaning it wouldn't work in real time scenarios. Maybe someone else could suggest a better way. Why do you need to know a unit's HP regenation rate?
 
Level 14
Joined
Nov 30, 2013
Messages
924
I don't think so. You'd need to do the maths yourself I suppose. Something like this:

Base HP regen + (Strength Amount x (HP regen per strength stat)) + Items + Abilities

This could be complicated to work out depending on items and abilities/aura that affect HP regen.

There is an easy but dodgy way of automatically calculating Hp regen, but it wouldn't work under most circumstances. Here's the code:

  • Regen Amount
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of HpRegenTestUnit) Equal to (Max life of HpRegenTestUnit)
        • Then - Actions
          • Game - Display to (All players) for 1.00 seconds the text: Cannot caluclate HP...
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HasInitialHpBeenSet Equal to False
            • Then - Actions
              • Set HpRegenAmount = (Life of HpRegenTestUnit)
              • Set HasInitialHpBeenSet = True
            • Else - Actions
              • Set HpRegenAmount = ((Life of HpRegenTestUnit) - HpRegenAmount)
              • Game - Display to (All players) for 1.00 seconds the text: (HpRegenAmount: + (String(HpRegenAmount)))
              • -------- reset --------
              • Set HpRegenAmount = (Life of HpRegenTestUnit)
HpRegenTestUnit - The unit your testing
HpRegenAmount - A real. This value calculates Hp Regen Rate. You'd need to save this into a separate variable before it's reset
HasInititalHpBeenSet - A boolean.

This would only work if the unit has lost more life than what he regenerates per second and the value takes 1 second to update meaning it wouldn't work in real time scenarios. Maybe someone else could suggest a better way. Why do you need to know a unit's HP regenation rate?

Just using it for testing purposes. Thanks for helping me btw. :smile:
 
Status
Not open for further replies.
Top