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

Enchantress "Nature Attendants" spell doesn't heal.

Status
Not open for further replies.
Level 15
Joined
Jul 19, 2007
Messages
857
I have imported Enchantress "Nature Attendants" spell from a Dota Spellpack and yes I have imported everything that is required for it and checked everything in the triggers but it seems like the spell doesn't work like it should even in the spellpack because the spirits doesn't heal anyone which it's supposed to do... What could be wrong?
  • Constantes Habilidades Enchantress
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet HealingWisp_Ability = Healing Spirits
  • Healing Wisps
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to HealingWisp_Ability
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HW_Enteros[1] Equal to 0
        • Then - Actions
          • Trigger - Turn on Healing Wisps Loop <gen>
        • Else - Actions
      • Set VariableSet HW_Enteros[1] = (HW_Enteros[1] + 1)
      • Set VariableSet HW_Enteros[2] = (HW_Enteros[2] + 1)
      • Set VariableSet HW_Caster[HW_Enteros[2]] = (Triggering unit)
      • Set VariableSet HW_Numero[HW_Enteros[2]] = (2 + (2 x (Level of (Ability being cast) for (Triggering unit))))
      • Set VariableSet HW_Duracion[HW_Enteros[2]] = 10.00
  • Healing Wisps Loop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • For each (Integer HW_Enteros[3]) from 1 to HW_Enteros[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HW_Caster[HW_Enteros[3]] Not equal to No unit
            • Then - Actions
              • Set VariableSet HW_Duracion[HW_Enteros[3]] = (HW_Duracion[HW_Enteros[3]] - 0.04)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (HW_Duracion[HW_Enteros[3]] mod 1.00) Equal to 0.00
                • Then - Actions
                  • Set VariableSet Punto = (Position of HW_Caster[HW_Enteros[3]])
                  • For each (Integer A) from 1 to HW_Numero[HW_Enteros[3]], do (Actions)
                    • Loop - Actions
                      • Set VariableSet Grupo = (Units within 300.00 of Punto matching (((((Matching unit) is A structure) Equal to False) and ((Life of (Matching unit)) Less than (Max life of (Matching unit)))) and ((((Matching unit) is Mechanical) Equal to False) and (((Matching unit) belongs to an enemy
                      • Set VariableSet DummyHS = (Random unit from Grupo)
                      • Unit - Set life of DummyHS to ((Life of DummyHS) + 10.00)
                      • Custom script: call DestroyGroup(udg_Grupo)
                  • Custom script: call RemoveLocation(udg_Punto)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • HW_Duracion[HW_Enteros[3]] Less than or equal to 0.00
                • Then - Actions
                  • Set VariableSet HW_Caster[HW_Enteros[3]] = No unit
                  • Set VariableSet HW_Enteros[1] = (HW_Enteros[1] - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HW_Enteros[1] Equal to 0
                    • Then - Actions
                      • Set VariableSet HW_Enteros[2] = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
 
Level 24
Joined
Feb 27, 2019
Messages
833
I dont have enough math knowledge to comment on the problem but I was very confused with the math here. I was expecting that 2.00 modulo 1.0 would equal 0.00. That doesnt seem to be true in this case.

In Healing Wisps Loop change
  • (HW_Duracion[HW_Enteros[3]] mod 1.00) Equal to 0.00
to
  • (HW_Duracion[HW_Enteros[3]] mod 1.00) Equal to 0.04
 
Level 15
Joined
Jul 19, 2007
Messages
857
I dont have enough math knowledge to comment on the problem but I was very confused with the math here. I was expecting that 2.00 modulo 1.0 would equal 0.00. That doesnt seem to be true in this case.

In Healing Wisps Loop change
  • (HW_Duracion[HW_Enteros[3]] mod 1.00) Equal to 0.00
to
  • (HW_Duracion[HW_Enteros[3]] mod 1.00) Equal to 0.04
And that solved the problem. Thank you!
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Checking for the exact value of a Real is just asking for trouble. There's an issue when applying Arithmetic to these Reals which causes them to lose an extremely small fraction of precision. It doesn't always happen right away but it seems like after a few times the problem starts to occur. For example, a Real that you'd expect to be equal to 10.00 could actually be equal to 9.99999. So when you check "is my variable equal to 0.04" it'll return False even though the calculations seem to all check out.

In this case, Duration should be an Integer variable so that you're guaranteed 100% precision.
 
Last edited:
Status
Not open for further replies.
Top