• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

What's wrong with the Unit - Set life action?

Status
Not open for further replies.
Level 11
Joined
Jan 23, 2015
Messages
788
Guys, apoligies if it's a dumb question, but, is there something wrong with this action? I am stressing over this trigger whole day and I don't know what I am doing wrong but the it doesn't set the unit's life to the value I want it to.
I am trying to make a unit's life hit-based (it dies after certain amount of times it gets hit).

Btw, the unit is a structure, does that has something to do with the bug?

  • TombHit
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
      • (Unit-type of PDD_target) Equal to Tomb
      • PDD_damageType Equal to PDD_PHYSICAL
      • TombHitsRemaining[(Player number of (Owner of PDD_target))] Not equal to 0
    • Actions
      • Set TombIndex = (Player number of (Owner of PDD_target))
      • Set TombHitsRemaining[TombIndex] = (TombHitsRemaining[TombIndex] - 1)
      • Set PDD_amount = 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TombHitsRemaining[TombIndex] Equal to 0
        • Then - Actions
          • Unit - Cause PDD_source to damage PDD_target, dealing 99999.00 damage of attack type Spells and damage type Normal
          • Game - Display to (All players) the text: (String(TombHitsRemaining[TombIndex]))
        • Else - Actions
          • Game - Display to (All players) the text: (String(TombHitsRemaining[TombIndex]))
          • Unit - Set life of PDD_target to (((Max life of PDD_target) / (Real(TombHitsReq[TombLevel[TombIndex]]))) x (Real(TombHitsRemaining[TombIndex])))
          • Game - Display to (All players) the text: (String((((Max life of PDD_target) / (Real(TombHitsReq[TombLevel[TombIndex]]))) x (Real(TombHitsRemaining[TombIndex])))))
 
Level 21
Joined
Dec 4, 2007
Messages
1,480
Hm i'm not sure, but i found that dividing odd figures can bug out the overall result.
Wherefore i am splitting up calculations, like:
  • Set PH_PaladinHealSet1 = (((Real((Level of HeroLordPal (Healing Light) for (Triggering unit)))) x 200.00) + 0.00)
  • Set PH_PaladinHealSet2 = ((Real(PH_PaladinInt)) x ((Real((Level of HeroLordPal (Healing Light) for (Triggering unit)))) x 0.50))
  • Set PH_PaladinHealSet3 = ((Real(PH_PaladinInt)) x 2.50)
  • Set PH_PaladinHeal = (PH_PaladinHealSet1 + (PH_PaladinHealSet2 + PH_PaladinHealSet3))
  • Set PH_PaladinHeal2aoe = (PH_PaladinHeal / 2.00)
 
Status
Not open for further replies.
Top