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

[General] help me with a loop trigger

Shadow Pact (modified drain life spell)
Transfers life essence by almost instantly taking 55 hit points from the Witch Doctor and giving 75 hit points to a target friendly unit. |nAlso the Witch Doctor gains a invulnerability shield for 5 seconds afterwards. |nIf the Witch Doctor perished while casting this spell, then target friendly unit gains the shield.
This is the ability i am in the process of making trigger for, so far it functions, sans the last part about giving shield to target instead if the caster has died.

The issue im facing is if when the second if,then,else block with the
  • ((ShadowPact_Target is alive) Equal to True) and ((ShadowPact_Caster is alive) Not equal to True)
gets turned on then everything goes haywire.
How can that be fixed, is it needed to loop the second seperately ? Also would like to ask if this could be done without having to use a periodic loop at all ?

In addition i can tell that Shadow Pact (dummy shield fx) is a modified dummy rejuvenation spell, it gives the buff to show shield fx on unit(and used for checking invulnerability)
  • Shadow Pact shield
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Shadow Pact
    • Actions
      • Set ShadowPact_Caster = (Triggering unit)
      • Set ShadowPact_Target = (Target unit of ability being cast)
      • Unit - Create 1 Dummy Unit (0 Collision) for (Owner of (Triggering unit)) at (Position of ShadowPact_Caster) facing (Position of ShadowPact_Target)
      • Set ShadowPact_Dummy = (Last created unit)
      • Unit - Add a 3.00 second Generic expiration timer to ShadowPact_Dummy
      • Unit - Add Shadow Pact (dummy shield fx) to ShadowPact_Dummy
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ShadowPact_Caster is alive) Equal to True
        • Then - Actions
          • Unit - Order ShadowPact_Dummy to Night Elf Druid Of The Claw - Rejuvenation ShadowPact_Caster
          • Set ShadowPact_TempUnit = ShadowPact_Caster
          • Unit Group - Add ShadowPact_TempUnit to ShadowPact_Group
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((ShadowPact_Target is alive) Equal to True) and ((ShadowPact_Caster is alive) Not equal to True)
        • Then - Actions
          • Unit - Order ShadowPact_Dummy to Night Elf Druid Of The Claw - Rejuvenation ShadowPact_Target
          • Set ShadowPact_TempUnit = ShadowPact_Target
          • Unit Group - Add ShadowPact_TempUnit to ShadowPact_Group
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in ShadowPact_Group) Greater than 0
        • Then - Actions
          • Trigger - Turn on Shadow Pact loop <gen>
        • Else - Actions
and this is the loop trigger:
  • Shadow Pact loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ShadowPact_Group and do (Actions)
        • Loop - Actions
          • Set ShadowPact_TempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ShadowPact_TempUnit has buff Shadow Pact ) Equal to True
            • Then - Actions
              • Unit - Add ShadowPact_Invuln to ShadowPact_TempUnit
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ShadowPact_TempUnit has buff Shadow Pact ) Equal to False
            • Then - Actions
              • Unit - Remove ShadowPact_Invuln from ShadowPact_TempUnit
              • Unit Group - Remove ShadowPact_TempUnit from ShadowPact_Group
            • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
Nichilus is correct but in this particular case you want to use "Stops casting" since your ability is channeling and you want to detect when this effect ends.

Here are the triggers cleaned up and working (I tested):
  • ShadowPact Stop Channeling
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Shadow Pact (Hero)
    • Actions
      • Set ShadowPact_Source = (Triggering unit)
      • Set ShadowPact_Target = (Target unit of ability being cast)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ShadowPact_Source is alive) Equal to True
        • Then - Actions
          • -------- Dummy buff: --------
          • Set ShadowPact_Point = (Position of ShadowPact_Source)
          • Unit - Create 1 Dummy (Uncle) for (Owner of ShadowPact_Source) at ShadowPact_Point facing Default building facing degrees
          • Custom script: call RemoveLocation( udg_ShadowPact_Point )
          • Set ShadowPact_Dummy = (Last created unit)
          • Unit - Add a 0.20 second Generic expiration timer to ShadowPact_Dummy
          • Unit - Add Shadow Pact (Dummy) to ShadowPact_Dummy
          • Unit - Order ShadowPact_Dummy to Human Priest - Inner Fire ShadowPact_Source
          • -------- --------
          • Unit - Add Invulnerable (Shadow Pact) to ShadowPact_Source
          • Unit Group - Add ShadowPact_Source to ShadowPact_Group
          • Trigger - Turn on ShadowPact Loop <gen>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ShadowPact_Target is alive) Equal to True
            • Then - Actions
              • -------- Dummy buff: --------
              • Set ShadowPact_Point = (Position of ShadowPact_Target)
              • Unit - Create 1 Dummy (Uncle) for (Owner of ShadowPact_Target) at ShadowPact_Point facing Default building facing degrees
              • Custom script: call RemoveLocation( udg_ShadowPact_Point )
              • Set ShadowPact_Dummy = (Last created unit)
              • Unit - Add a 0.20 second Generic expiration timer to ShadowPact_Dummy
              • Unit - Add Shadow Pact (Dummy) to ShadowPact_Dummy
              • Unit - Order ShadowPact_Dummy to Human Priest - Inner Fire ShadowPact_Target
              • -------- --------
              • Unit - Add Invulnerable (Shadow Pact) to ShadowPact_Target
              • Unit Group - Add ShadowPact_Target to ShadowPact_Group
              • Trigger - Turn on ShadowPact Loop <gen>
            • Else - Actions
  • ShadowPact Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ShadowPact_Group and do (Actions)
        • Loop - Actions
          • Set ShadowPact_Source = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ShadowPact_Source has buff Shadow Pact ) Equal to False
            • Then - Actions
              • Unit - Remove Invulnerable (Shadow Pact) from ShadowPact_Source
              • Unit Group - Remove ShadowPact_Source from ShadowPact_Group.
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in ShadowPact_Group) Equal to 0
                • Then - Actions
                  • Trigger - Turn off ShadowPact Loop <gen>
                • Else - Actions
            • Else - Actions
Another reason your triggers wouldn't work is if you have failed to setup your Dummy unit the correct way. A proper Dummy unit can cast any number of abilities at once without any delay. An improper Dummy unit will have a delay when casting spells which in this case could cause the "Unit has buff" Condition to run before the buff was actually applied.

A Dummy unit should be designed like so:
1) Copy and paste the Locust. This is under the Undead - Special category.
2) Set Model = None, Shadow = None, Attacks Enabled = None, Movement Type = None, Speed Base = 0.
3) Ensure it's abilities have 99999 cast range, 0 mana cost, no requirements, and proper targets allowed.

Also, I recommend using Inner Fire with Targets Allowed set to Invulnerable/Vulnerable instead of Rejuvenation. If I recall correctly, Rejuvenation fails if the target is at full hp while Inner Fire doesn't have any hardcoded restrictions.
 

Attachments

  • Shadow Pact 2.w3m
    19.8 KB · Views: 0
Last edited:
thank you both.

i didnt know about the dummy spells should have 99999 cast range thing for instance, thats new to me.

my dummy has got both Locust and Crow Form, although i cannot remember why it does have the latter.
Suppose it might be since the one i am using is, if i remember correctly, was the vexorians spell dummy pasted from wc3c back when it was still a thing.
can please tell me what does Crow Form when assigned on to a dummy ?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
thank you both.

i didnt know about the dummy spells should have 99999 cast range thing for instance, thats new to me.

my dummy has got both Locust and Crow Form, although i cannot remember why it does have the latter.
Suppose it might be since the one i am using is, if i remember correctly, was the vexorians spell dummy pasted from wc3c back when it was still a thing.
can please tell me what does Crow Form when assigned on to a dummy ?
No problem :) So there are two kinds of Dummy units and both have very specific use cases.

The first type of Dummy unit is meant to be combined with triggers to act as a custom Missile. These units have a model like the Vexorian model you mentioned and have specific Movement settings that allow them to move around in triggers. HOWEVER, this change of Movement Type means that they now have the flaw of needing to turn to face their target when casting spells. This flaw makes their targeted spells unreliable and slow to cast.

Notes about Dummy #1:
1) Crow Form allows you to modify the flying height of a unit. You can add and even remove this ability from a unit and from that point on the unit's flying height can be changed. Flying Height goes hand in hand with a custom missile so it makes sense that this Dummy would have this ability.

2) The first Dummy unit became mostly obsolete when patch 1.31 introduced more natives (Actions) for interacting with Special Effects. In other words, we can replace these "missile" Dummy units with Special Effects in most cases and get better performance with less Object Editor junk.

The second type of Dummy unit is the one that I described earlier which is meant to be completely invisible and only do the following:
Cast spells as fast as Warcraft 3 will allow. In the case of your spell we would want to use this Dummy unit since it ensures that Inner Fire (or Rejuvenation) casts immediately.

Notes about Dummy #2:
1) You can still use the Vexorian dummy model on this unit as it could be useful for Art related stuff.

2) You can probably still use the Storm Crow Form ability on this unit. It could be useful for flying height related stuff in your triggers.


I would try not to overthink it. A Dummy unit has the same restrictions as any other unit. All the Locust ability does is make the unit Invulnerable, Unselectable, and immune to certain effects like Unit Group enumeration (Pick every unit within range). Also, my suggestion about the max Cast Range is meant to ensure that the Dummy unit will always be in range to cast it's spell. The end goal is to cast a spell without issues.
 
Last edited:
Top