• 🏆 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] Magic Resistance Aura

Status
Not open for further replies.
Hello I want to make a skill that : summon a frost core that will make all your units in the range of 500 magic resistance by 20% and enemy units -10% move speed and -15% attack speed in the range of 150
I added 2 aura to that frost core , 1 slow aura for -10% move speed and -15% attack speed in the range of 150 and another slow aura just for the buff
  • Untitled Trigger 004
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Frostium Crystal
    • Actions
      • Set FrostiumCrystal1 = (Position of (Summoned unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Add all units of (Units within 500.00 of FrostiumCrystal1) to FrostiumCrystal
      • Custom script: call RemoveLocation(udg_FrostiumCrystal1)
  • Untitled Trigger 008 Copy
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in FrostiumCrystal and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff ..Frostium Crystal (magic resistance aura)) Equal to True
            • Then - Actions
              • Unit - Add ..Frostium Crystal (magic resis) to (Picked unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff ..Frostium Crystal (magic resistance aura)) Equal to False
                • Then - Actions
                  • Unit - Remove ..Frostium Crystal (magic resis) from (Picked unit)
                  • Unit Group - Remove (Picked unit) from FrostiumCrystal
                • Else - Actions
Can somebody help me with this aura?
I'm using Warcraft 3 1.30.1
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
You're only Adding nearby units to the FrostiumCrystal Unit Group when you first cast the spell.
You want it to work like an Aura which will affect and Add new units that come within range of it.

So instead you should add your Frostium Crystal to the Unit Group, and then Periodically check for Allied units near the Crystals. If those units are allies of the Frostium Crystal (and you probably want to filter out Dead units / Structures / Mechanical) then give them the Magic Resist ability.

Removing the Magic Resist ability from your allies is a little bit tricky because you'll need to also track these units as well. You can do this with a second Unit Group which periodically Removes the ability if the Picked units don't have the buff.

Then you'll probably want to turn off the Periodic trigger once FrostiumCrystal is empty to keep things efficient.
 
Last edited:
You're only Adding nearby units to the FrostiumCrystal Unit Group when you first cast the spell.
You want it to work like an Aura which will affect and Add new units that come within range of it.

So instead you should add your Frostium Crystal to the Unit Group, and then Periodically check for Allied units near the Crystals. If those units are allies of the Frostium Crystal (and you probably want to filter out Dead units / Structures / Mechanical) then give them the Magic Resist ability.

Removing the Magic Resist ability from your allies is a little bit tricky because you'll need to also track these units as well. You can do this with a second Unit Group which periodically Removes the ability if the Picked units don't have the buff.

Then you'll probably want to turn off the Periodic trigger once FrostiumCrystal is empty to keep things efficient.
Thx for your reply. I will try your solution after work.
 
You're only Adding nearby units to the FrostiumCrystal Unit Group when you first cast the spell.
You want it to work like an Aura which will affect and Add new units that come within range of it.

So instead you should add your Frostium Crystal to the Unit Group, and then Periodically check for Allied units near the Crystals. If those units are allies of the Frostium Crystal (and you probably want to filter out Dead units / Structures / Mechanical) then give them the Magic Resist ability.

Removing the Magic Resist ability from your allies is a little bit tricky because you'll need to also track these units as well. You can do this with a second Unit Group which periodically Removes the ability if the Picked units don't have the buff.

Then you'll probably want to turn off the Periodic trigger once FrostiumCrystal is empty to keep things efficient.
  • Untitled Trigger 008 Copy
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in FrostiumCrystal and do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units within 500.00 of (Position of (Picked unit))) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) is Mechanical) Equal to False
                  • ((Picked unit) belongs to an enemy of (Owner of (Picked unit))) Equal to False
                • Then - Actions
                  • Unit - Add ..Frostium Crystal (magic resis) to (Picked unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between (Position of (Picked unit)) and (Position of (Picked unit))) Greater than or equal to 501.00
                    • Then - Actions
                      • Unit - Remove ..Frostium Crystal (magic resis) from (Picked unit)
                      • Unit Group - Remove (Picked unit) from FrostiumCrystal
                    • Else - Actions
I got stuck here
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Here's what I managed to get working. I'm on the latest patch so some things may look slightly different:
  • Crystal Cast
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Crystal
    • Actions
      • Set VariableSet Crystal = (Summoned unit)
      • Unit Group - Add Crystal to CrystalGroup
      • -------- --------
      • Set VariableSet CrystalPoint = (Position of Crystal)
      • Set VariableSet CrystalGroupTemp = (Units within 500.00 of CrystalPoint.)
      • -------- --------
      • Unit Group - Pick every unit in CrystalGroupTemp and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an ally of (Owner of Crystal).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is Mechanical) Equal to False
              • (Level of Magic Resistance (Crystal) for (Picked unit)) Equal to 0
            • Then - Actions
              • Unit - Add Magic Resistance (Crystal) to (Picked unit)
              • Unit Group - Add (Picked unit) to CrystalGroupAllies
            • Else - Actions
      • -------- --------
      • Custom script: call DestroyGroup(udg_CrystalGroupTemp)
      • Custom script: call RemoveLocation(udg_CrystalPoint)
      • -------- --------
      • Trigger - Turn on Crystal Loop <gen>
  • Crystal Loop
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CrystalGroupAllies and do (Actions)
        • Loop - Actions
          • Unit - Remove Magic Resistance (Crystal) from (Picked unit)
          • Unit Group - Remove (Picked unit) from CrystalGroupAllies.
      • -------- --------
      • Unit Group - Pick every unit in CrystalGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Crystal = (Picked unit)
          • Set VariableSet CrystalPoint = (Position of Crystal)
          • Set VariableSet CrystalGroupTemp = (Units within 500.00 of CrystalPoint.)
          • -------- --------
          • Unit Group - Pick every unit in CrystalGroupTemp and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) belongs to an ally of (Owner of Crystal).) Equal to True
                  • ((Picked unit) is alive) Equal to True
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) is Mechanical) Equal to False
                  • (Level of Magic Resistance (Crystal) for (Picked unit)) Equal to 0
                • Then - Actions
                  • Unit - Add Magic Resistance (Crystal) to (Picked unit)
                  • Unit Group - Add (Picked unit) to CrystalGroupAllies
                • Else - Actions
          • -------- --------
          • Custom script: call RemoveLocation(udg_CrystalPoint)
          • Custom script: call DestroyGroup(udg_CrystalGroupTemp)
  • Crystal Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Crystal
    • Actions
      • Unit Group - Remove (Triggering unit) from CrystalGroup.
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in CrystalGroup) Equal to 0
        • Then - Actions
          • Unit Group - Pick every unit in CrystalGroupAllies and do (Actions)
            • Loop - Actions
              • Unit - Remove Magic Resistance (Crystal) from (Picked unit)
              • Unit Group - Remove (Picked unit) from CrystalGroupAllies.
          • Trigger - Turn off Crystal Loop <gen>
        • Else - Actions
 

Attachments

  • Crystal Slow 1.w3m
    20 KB · Views: 17
Here's what I managed to get working. I'm on the latest patch so some things may look slightly different:
  • Crystal Cast
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Crystal
    • Actions
      • Set VariableSet Crystal = (Summoned unit)
      • Unit Group - Add Crystal to CrystalGroup
      • -------- --------
      • Set VariableSet CrystalPoint = (Position of Crystal)
      • Set VariableSet CrystalGroupTemp = (Units within 500.00 of CrystalPoint.)
      • -------- --------
      • Unit Group - Pick every unit in CrystalGroupTemp and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an ally of (Owner of Crystal).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is Mechanical) Equal to False
              • (Level of Magic Resistance (Crystal) for (Picked unit)) Equal to 0
            • Then - Actions
              • Unit - Add Magic Resistance (Crystal) to (Picked unit)
              • Unit Group - Add (Picked unit) to CrystalGroupAllies
            • Else - Actions
      • -------- --------
      • Custom script: call DestroyGroup(udg_CrystalGroupTemp)
      • Custom script: call RemoveLocation(udg_CrystalPoint)
      • -------- --------
      • Trigger - Turn on Crystal Loop <gen>
  • Crystal Loop
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CrystalGroupAllies and do (Actions)
        • Loop - Actions
          • Unit - Remove Magic Resistance (Crystal) from (Picked unit)
          • Unit Group - Remove (Picked unit) from CrystalGroupAllies.
      • -------- --------
      • Unit Group - Pick every unit in CrystalGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Crystal = (Picked unit)
          • Set VariableSet CrystalPoint = (Position of Crystal)
          • Set VariableSet CrystalGroupTemp = (Units within 500.00 of CrystalPoint.)
          • -------- --------
          • Unit Group - Pick every unit in CrystalGroupTemp and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) belongs to an ally of (Owner of Crystal).) Equal to True
                  • ((Picked unit) is alive) Equal to True
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) is Mechanical) Equal to False
                  • (Level of Magic Resistance (Crystal) for (Picked unit)) Equal to 0
                • Then - Actions
                  • Unit - Add Magic Resistance (Crystal) to (Picked unit)
                  • Unit Group - Add (Picked unit) to CrystalGroupAllies
                • Else - Actions
          • -------- --------
          • Custom script: call RemoveLocation(udg_CrystalPoint)
          • Custom script: call DestroyGroup(udg_CrystalGroupTemp)
  • Crystal Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Crystal
    • Actions
      • Unit Group - Remove (Triggering unit) from CrystalGroup.
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in CrystalGroup) Equal to 0
        • Then - Actions
          • Unit Group - Pick every unit in CrystalGroupAllies and do (Actions)
            • Loop - Actions
              • Unit - Remove Magic Resistance (Crystal) from (Picked unit)
              • Unit Group - Remove (Picked unit) from CrystalGroupAllies.
          • Trigger - Turn off Crystal Loop <gen>
        • Else - Actions
Thx so much I will try to make the trigger like yours because i can't open your map (1.30.1). Thx so much for your help
 
Here's what I managed to get working. I'm on the latest patch so some things may look slightly different:
  • Crystal Cast
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Crystal
    • Actions
      • Set VariableSet Crystal = (Summoned unit)
      • Unit Group - Add Crystal to CrystalGroup
      • -------- --------
      • Set VariableSet CrystalPoint = (Position of Crystal)
      • Set VariableSet CrystalGroupTemp = (Units within 500.00 of CrystalPoint.)
      • -------- --------
      • Unit Group - Pick every unit in CrystalGroupTemp and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an ally of (Owner of Crystal).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is Mechanical) Equal to False
              • (Level of Magic Resistance (Crystal) for (Picked unit)) Equal to 0
            • Then - Actions
              • Unit - Add Magic Resistance (Crystal) to (Picked unit)
              • Unit Group - Add (Picked unit) to CrystalGroupAllies
            • Else - Actions
      • -------- --------
      • Custom script: call DestroyGroup(udg_CrystalGroupTemp)
      • Custom script: call RemoveLocation(udg_CrystalPoint)
      • -------- --------
      • Trigger - Turn on Crystal Loop <gen>
  • Crystal Loop
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CrystalGroupAllies and do (Actions)
        • Loop - Actions
          • Unit - Remove Magic Resistance (Crystal) from (Picked unit)
          • Unit Group - Remove (Picked unit) from CrystalGroupAllies.
      • -------- --------
      • Unit Group - Pick every unit in CrystalGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Crystal = (Picked unit)
          • Set VariableSet CrystalPoint = (Position of Crystal)
          • Set VariableSet CrystalGroupTemp = (Units within 500.00 of CrystalPoint.)
          • -------- --------
          • Unit Group - Pick every unit in CrystalGroupTemp and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) belongs to an ally of (Owner of Crystal).) Equal to True
                  • ((Picked unit) is alive) Equal to True
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) is Mechanical) Equal to False
                  • (Level of Magic Resistance (Crystal) for (Picked unit)) Equal to 0
                • Then - Actions
                  • Unit - Add Magic Resistance (Crystal) to (Picked unit)
                  • Unit Group - Add (Picked unit) to CrystalGroupAllies
                • Else - Actions
          • -------- --------
          • Custom script: call RemoveLocation(udg_CrystalPoint)
          • Custom script: call DestroyGroup(udg_CrystalGroupTemp)
  • Crystal Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Crystal
    • Actions
      • Unit Group - Remove (Triggering unit) from CrystalGroup.
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in CrystalGroup) Equal to 0
        • Then - Actions
          • Unit Group - Pick every unit in CrystalGroupAllies and do (Actions)
            • Loop - Actions
              • Unit - Remove Magic Resistance (Crystal) from (Picked unit)
              • Unit Group - Remove (Picked unit) from CrystalGroupAllies.
          • Trigger - Turn off Crystal Loop <gen>
        • Else - Actions
Thx so much is working you are the best +rep
  • Crystal Cast
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Frostium Crystal
    • Actions
      • Set FrostiumCrystalUnit = (Summoned unit)
      • Unit Group - Add FrostiumCrystalUnit to FrostiumCrystalGroup
      • -------- --------
      • Set FrostiumCrystalPoint = (Position of FrostiumCrystalUnit)
      • Set FrostiumCrystalGroupTemp = (Units within 500.00 of FrostiumCrystalPoint)
      • -------- --------
      • Unit Group - Pick every unit in FrostiumCrystalGroupTemp and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an ally of (Owner of FrostiumCrystalUnit)) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is Mechanical) Equal to False
              • ((Picked unit) is A structure) Equal to False
            • Then - Actions
              • Unit - Add ..Frostium Crystal (magic resis) to (Picked unit)
              • Unit Group - Add (Picked unit) to FrostiumCrystalGroupAllies
            • Else - Actions
      • -------- --------
      • Custom script: call DestroyGroup(udg_FrostiumCrystalGroupTemp)
      • Custom script: call RemoveLocation(udg_FrostiumCrystalPoint)
      • -------- --------
      • Trigger - Turn on Crystal Loop <gen>
  • Events
    • Time - Every 1.00 seconds of game time
  • Actions
    • Unit Group - Pick every unit in FrostiumCrystalGroupAllies and do (Actions)
      • Loop - Actions
        • Unit - Remove ..Frostium Crystal (magic resis) from (Picked unit)
        • Unit Group - Remove (Picked unit) from FrostiumCrystalGroupAllies
    • -------- --------
    • Unit Group - Pick every unit in FrostiumCrystalGroup and do (Actions)
      • Loop - Actions
        • Set FrostiumCrystalUnit = (Picked unit)
        • Set FrostiumCrystalPoint = (Position of FrostiumCrystalUnit)
        • Set FrostiumCrystalGroupTemp = (Units within 500.00 of FrostiumCrystalPoint)
        • Unit Group - Pick every unit in FrostiumCrystalGroupTemp and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) belongs to an ally of (Owner of FrostiumCrystalUnit)) Equal to True
                • ((Picked unit) is alive) Equal to True
                • ((Picked unit) is Mechanical) Equal to False
                • ((Picked unit) is A structure) Equal to False
              • Then - Actions
                • Unit - Add ..Frostium Crystal (magic resis) to (Picked unit)
                • Unit Group - Add (Picked unit) to FrostiumCrystalGroupAllies
              • Else - Actions
    • -------- --------
    • Custom script: call RemoveLocation(udg_FrostiumCrystalPoint)
    • Custom script: call DestroyGroup(udg_FrostiumCrystalGroupTemp)
  • Crystal Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Frostium Crystal
    • Actions
      • Unit Group - Remove (Triggering unit) from FrostiumCrystalGroup
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in FrostiumCrystalGroup) Equal to 0
        • Then - Actions
          • Unit Group - Pick every unit in FrostiumCrystalGroupAllies and do (Actions)
            • Loop - Actions
              • Unit - Add ..Frostium Crystal (magic resis) to (Picked unit)
              • Unit Group - Remove (Picked unit) from FrostiumCrystalGroupAllies
          • Trigger - Turn off Crystal Loop <gen>
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
No problem, here's some issues I see:

You forgot to add this Condition to your Pick Every Unit functions:
  • (Level of ..Frostium Crystal (magic resis) for (Picked unit)) Equal to 0
This will prevent units that already have the Magic Resist ability from being targeted again.

And in the Crystal Dies trigger you need to Remove Frostium Crystal (magic resist) not Add it:
  • Loop - Actions
  • Unit - Remove ..Frostium Crystal (magic resis) from (Picked unit)
  • Unit Group - Remove (Picked unit) from FrostiumCrystalGroupAllies
 
No problem, here's some issues I see:

You forgot to add this Condition to your Pick Every Unit functions:
  • (Level of ..Frostium Crystal (magic resis) for (Picked unit)) Equal to 0
This will prevent units that already have the Magic Resist ability from being targeted again.

And in the Crystal Dies trigger you need to Remove Frostium Crystal (magic resist) not Add it:
  • Loop - Actions
  • Unit - Remove ..Frostium Crystal (magic resis) from (Picked unit)
  • Unit Group - Remove (Picked unit) from FrostiumCrystalGroupAllies
Thx I fixed those issues
 
Status
Not open for further replies.
Top