• 🏆 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!

[Trigger] Ability is not working

Status
Not open for further replies.
Level 6
Joined
Oct 18, 2008
Messages
100
What does the ability need to do:

Creates 4 divine spirits for 10 seconds that heal nearby allied units.
But they target the unit with the lowest health.

It only heals once for some reason.

Cast:
  • DivineCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) |cffffd700Divine Spirits|r (real)
    • Actions
      • Set Spel_Unit = (Triggering unit)
      • Set Spell_Level = (Level of (Ability being cast) for (Triggering unit))
        • Do Multiple ActionsFor each (Integer Spell_INT) from 1 to 4, do (Actions)
          • Loop - Actions
            • Set Temp_Point = (Position of (Triggering unit))
            • Unit - Create 1 Holy Spirit for (Owner of (Triggering unit)) at Temp_Point facing Default building facing (270.0) degrees
            • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
            • Unit Group - Add (Last created unit) to Spell_Group_2
            • Unit - Set level of Healing Wave for (Last created unit) to Spell_Level
            • Custom script: call RemoveLocation(udg_Temp_Point)
      • Set Spell_Index = 5
Effect:

  • DivineSpirits
    • Events
      • Time - SpellTimer expires
    • Conditions
      • Spell_Index Not equal to (!=) 0
    • Actions
      • Set Spell_Group = Spell_Group_2
      • Unit Group - Pick every unit in Spell_Group and do (Actions)
        • Loop - Actions
          • Set Spel_Unit = (Picked unit)
          • Set Spell_Point = (Position of (Picked unit))
          • Set Spell_Group_3 = (Units within 512.00 of Spell_Point matching (((Matching unit) belongs to an ally of (Owner of Spel_Unit)) Equal to (==) True))
          • Unit Group - Pick every unit in Spell_Group_3 and do (Actions)
            • Loop - Actions
              • Quest - Display to (All players) the Quest Update message: (Name of (Picked unit))
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Percentage life of (Picked unit)) Less than (<) 100.00
                    • (Unit-type of (Picked unit)) Not equal to (!=) Holy Spirit
                  • Then - Actions
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • Spell_Target Equal to (==) No unit
                      • Then - Actions
                        • Set Spell_Target = (Picked unit)
                      • Else - Actions
                        • Do nothing
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Life of (Picked unit)) Less than (<) (Life of Spell_Target)
                        • Spell_Target Not equal to (!=) No unit
                      • Then - Actions
                        • Quest - Display to (All players) the Quest Update message: SpellCondition 2
                        • Set Spell_Target = (Picked unit)
                      • Else - Actions
                        • Do nothing
                  • Else - Actions
                    • Do nothing
          • Custom script: call RemoveLocation(udg_Temp_Point)
          • Unit - Order Spel_Unit to Orc Shadow Hunter - Healing Wave Spell_Target
          • Set Spell_Target = No unit
          • Custom script: call DestroyGroup(udg_Spell_Group_3)
      • Set Spell_Index = (Spell_Index - 1)
      • Custom script: call DestroyGroup(udg_Spell_Group)
 
all spirits hit healing once but they don't heal anymore.
-->huh? sorry, I can't understand the statement...

ah you mean, if you cast it once, it heals for all spirits, after that it won't?

its because you destroyed udg_Spell_Group which points to udg_Spell_Group2 (meaning the group in udg_Spell_Group is the same group as udg_Spell_Group2 so if you call DestroyGroup(udg_Spell_Group) it actually destroys udg_Spell_Group2)...

no need for the destroy as you only created it once (via the variable editor), and just added the units to it... just remove each unit individually inside the loop... actually, you don't even need the udg_Spell_Group there, just use udg_Spell_Group2 directly...
 
Level 6
Joined
Oct 18, 2008
Messages
100
They all do a healing wave (all spirits).

Than after the second loop they don't do a healing wave anymore.

But clearing also means it wont be able to be used for multiple heroes if I am correct.

If they both cast it at the same time that will bug one an other?

but ill try and see if it works anyway thx for your help!
 
though right now, its pretty not accurate as your loop time is every 2 seconds...

if you would learn indexing or hashtables sometime, you should reduce the time to maybe .03 or .05 seconds, then maybe add a variable which checks the time of each spirit maybe then make them cast heal when the variable reaches a certain value... if you want a standardized working time for all the spirits... ^_^
 
Status
Not open for further replies.
Top