• 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.

[Trigger] calculation fail

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
I am currently trying to create a spell but it fails slightly..

The following trigger should reduce the hp until it reaches 1 (aka not killing the unit) however it stays at 2 instead of 1.

  • Set target_unit = (Picked unit)
  • Set life = (Life of target_unit)
  • Set max_life = (Max life of target_unit)
  • Set calculation = (life - (max_life / 100.00))
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • calculation Less than 2.00
    • Then - Actions
      • Unit - Set life of target_unit to (life - (life - 1.00))
    • Else - Actions
      • Unit - Set life of target_unit to (life - (max_life / 100.00))
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Why not just this

  • Set target_unit = (Picked unit)
  • Set life = (Life of target_unit)
  • Set max_life = (Max life of target_unit)
  • Set calculation = (life - (max_life / 100.00))
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • calculation Less than 2.00
    • Then - Actions
      • Unit - Set life of target_unit to 1
    • Else - Actions
      • Unit - Set life of target_unit to calculation
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
I think the STR stat does give bonus HP regen, unless you disable it from the gameplay constants.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Instead of setting life to 1, you can set it to 0.500 so it will show as 1.That is probably the reason why it shows 2 so quickly instead of 1.
 
Ceday is right, hp is rounded up. Remember that widget life is represented via real, even tho in-game it is shown as an integer.

  • Set target_unit = (Picked unit)
  • Set life = (Life of target_unit)
  • Set max_life = (Max life of target_unit)
  • Set calculation = (life - (max_life / 100.00))
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • calculation Greater than 0.50
    • Then - Actions
      • Unit - Set life of target_unit to calculation
    • Else - Actions
Btw, "set unit life" is rather "true damage" rather than actuall "damage". True damage ignores any resistances and armor values.
 
I think I get your point now... however it still doesn't work even with that change. I will disable hp reg to make sure will edit in a few seconds.

edit: ok so I disabled hp reg on my test units. The Archmage hp stays at 2 hp while the footmen goes down to 1. might it be like that because strength gives hp reg?
That regen issue.

a. Yes, Str Regen.
b. The hero hp/mana regen in OE is only followed after the first revive. (tested)
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
I tried with hp regen and set it to 50, maybe your case is different.

Edit: I put a bloodmage to an empty map, set int mana regen to 0, set hero mana regen to 0 and casted a flamestrike.He isn't regenerating mana now.Can you test again?
 
Status
Not open for further replies.
Top