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

[Spell] MUI Aura has 2 bugs which I can't find the cause

Status
Not open for further replies.
Level 12
Joined
May 16, 2020
Messages
660
Hi guys,

I'm building an aura which reduces the magic resitance of nearby enemies.

The trigger below works for two Heroes who are affecting different units. However, as soon as both Heroes affect the same unit, or a Hero dies while affecting enemies, it bugs:
  1. If Hero_1 affects unit X and I bring Hero_2 into range of unit X, the spell works. However, if move one of the Heros away from unit X, unit X loses the debuff, even though the other Hero is still nearby.
  2. If a Hero dies while affecting units, the special effect stays forever. I can only fix it by brining the other Hero nearby affected units and moving him out of range again.
Does anyone see what is going wrong here?

***
  • Searing Elements
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Searing Elements
      • (Learned skill level) Equal to 1
    • Actions
      • Unit Group - Add (Triggering unit) to SearingElements_GroupHero
      • Set VariableSet SearingElements_CV = (Custom value of (Triggering unit))
      • Custom script: set udg_SearingElements_GroupInside[udg_SearingElements_CV] = CreateGroup()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Searing Elements Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Searing Elements Loop <gen>
        • Else - Actions
  • Searing Elements Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in SearingElements_GroupHero and do (Actions)
        • Loop - Actions
          • Set VariableSet SearingElements_Caster = (Picked unit)
          • Set VariableSet SearingElements_CV = (Custom value of SearingElements_Caster)
          • Set VariableSet SearingElements_Point[1] = (Position of SearingElements_Caster)
          • -------- ADD UNITS --------
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 650.00 of SearingElements_Point[1].) and do (Actions)
            • Loop - Actions
              • Set VariableSet SearingElements_TempUnit = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (SearingElements_Caster is alive) Equal to False
                  • (SearingElements_TempUnit is alive) Equal to True
                  • (SearingElements_TempUnit is A structure) Equal to False
                  • (SearingElements_TempUnit is Magic Immune) Equal to False
                  • (SearingElements_TempUnit belongs to an enemy of (Owner of SearingElements_Caster).) Equal to True
                  • (SearingElements_TempUnit is in SearingElements_GroupInside[SearingElements_CV].) Equal to False
                • Then - Actions
                  • Unit Group - Add SearingElements_TempUnit to SearingElements_GroupInside[SearingElements_CV]
                  • Unit - Add Searing Elements (Magic Reduction) to SearingElements_TempUnit
                  • Ability - Set Ability: (Unit: SearingElements_TempUnit's Ability with Ability Code: Searing Elements (Magic Reduction))'s Real Level Field: Damage Reduction ('isr2') of Level: 0 to (-0.05 + (-0.05 x (Real((Level of Searing Elements for SearingElements_Caster)))))
                  • Unit - Add Searing Elements (Aura) to SearingElements_TempUnit
                • Else - Actions
          • -------- REMOVE UNITS --------
          • Unit Group - Pick every unit in SearingElements_GroupInside[SearingElements_CV] and do (Actions)
            • Loop - Actions
              • Set VariableSet SearingElements_TempUnit = (Picked unit)
              • Set VariableSet SearingElements_Point[2] = (Position of SearingElements_TempUnit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (SearingElements_Caster is alive) Equal to False
                      • (SearingElements_TempUnit is alive) Equal to False
                      • (Distance between SearingElements_Point[1] and SearingElements_Point[2]) Greater than 650.00
                • Then - Actions
                  • Unit Group - Remove SearingElements_TempUnit from SearingElements_GroupInside[SearingElements_CV].
                  • Unit - Remove Searing Elements (Magic Reduction) from SearingElements_TempUnit
                  • Unit - Remove Searing Elements (Aura) from SearingElements_TempUnit
                  • Unit - Remove Searing Elements (Enemy) buff from SearingElements_TempUnit
                • Else - Actions
              • Custom script: call RemoveLocation(udg_SearingElements_Point[2])
          • Custom script: call RemoveLocation(udg_SearingElements_Point[1])
 
Level 12
Joined
May 16, 2020
Messages
660
Thanks Uncle, adding the code here for comparison.

There are a few things:
  • In your solution the Aura on the target is removed and added over and over again. In my map this is not so good, because the special effect sound is quite obnoxious on repeat.
  • Why don't you remove the units from TargetGroup? This group could get quite big over the game, so isn't it better to remove units and then add them?
  • In your trigger you create a TargetGroup without array. Isn't it better to have an array, to being able to add the aura with each Caster's level to the unit? Because currently this leads to a problem. Example:
  1. Unit X is affected by the weak aura from Caster A
  2. Then Caster B comes close with strong aura (so Unit X is affected by weak and strong aura)
  3. Then Caster B with strong aura moves out of range
  4. Unit X is now affected by strong aura From Caster B who is out of range, not Caster A with the weak aura in range
The last point is why I thought adding an array is better, but maybe this leads to other problems.


  • Celerity Aura Learn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Celerity Aura (Hero)
      • (Level of Celerity Aura (Hero) for (Triggering unit)) Equal to 1
    • Actions
      • Unit Group - Add (Triggering unit) to Celerity_SourceGroup
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Celerity Aura Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Celerity Aura Loop <gen>
        • Else - Actions
  • Celerity Aura Loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Celerity_TargetGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Celerity_Target = (Picked unit)
          • Unit - Remove Celerity Aura (Attack Speed) from Celerity_Target
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Celerity_Target is in Celerity_SourceGroup.) Equal to False
            • Then - Actions
              • Special Effect - Destroy Celerity_Sfx[(Custom value of Celerity_Target)]
            • Else - Actions
      • -------- --------
      • Unit Group - Pick every unit in Celerity_SourceGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Celerity_Source = (Picked unit)
          • Set VariableSet Celerity_Level = (Level of Celerity Aura (Hero) for Celerity_Source)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Celerity_Source is alive) Equal to True
              • Celerity_Level Greater than 0
            • Then - Actions
              • Set VariableSet Celerity_Point = (Position of Celerity_Source)
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units within 900.00 of Celerity_Point.) and do (Actions)
                • Loop - Actions
                  • Set VariableSet Celerity_Target = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Celerity_Target is alive) Equal to True
                      • (Celerity_Target belongs to an ally of (Owner of Celerity_Source).) Equal to True
                      • (Celerity_Target is A structure) Equal to False
                      • (Celerity_Target is Mechanical) Equal to False
                      • (Celerity_Target is A melee attacker) Equal to False
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Celerity Aura (Attack Speed) for Celerity_Target) Equal to 0
                        • Then - Actions
                          • Unit - Add Celerity Aura (Attack Speed) to Celerity_Target
                          • Unit - Set level of Celerity Aura (Attack Speed) for Celerity_Target to Celerity_Level
                          • Unit Group - Add Celerity_Target to Celerity_TargetGroup
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Celerity_Target is in Celerity_SourceGroup.) Equal to False
                            • Then - Actions
                              • Special Effect - Create a special effect attached to the origin of Celerity_Target using Abilities\Spells\Other\GeneralAuraTarget\GeneralAuraTarget.mdl
                              • Set VariableSet Celerity_Sfx[(Custom value of Celerity_Target)] = (Last created special effect)
                            • Else - Actions
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Celerity_Level Greater than (Level of Celerity Aura (Attack Speed) for Celerity_Target)
                            • Then - Actions
                              • Unit - Set level of Celerity Aura (Attack Speed) for Celerity_Target to Celerity_Level
                            • Else - Actions
                      • Unit - For Celerity_Target, Ability Celerity Aura (Attack Speed), Disable ability: True, Hide UI: False
                      • Unit - For Celerity_Target, Ability Celerity Aura (Attack Speed), Disable ability: False, Hide UI: False
                    • Else - Actions
              • Custom script: call RemoveLocation (udg_Celerity_Point)
            • Else - Actions
              • Unit Group - Remove Celerity_Source from Celerity_SourceGroup.
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Celerity_SourceGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off Celerity Aura Loop <gen>
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,884
1) The Aura art is done through triggers, none of the abilities in the Object Editor actually use any Art besides the Heroes Endurance Aura effect (which doesn't get removed). But i'm sure this could be adjusted so that the sfx isn't repeatedly created/destroyed.

2) Good catch, I think I was originally doing this but deleted it for some reason. I updated the Loop trigger:
  • Unit Group - Pick every unit in Celerity_TargetGroup and do (Actions)
    • Loop - Actions
      • Set VariableSet Celerity_Target = (Picked unit)
      • Unit - Remove Celerity Aura (Attack Speed) from Celerity_Target
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Celerity_Target is in Celerity_SourceGroup.) Equal to False
        • Then - Actions
          • Special Effect - Destroy Celerity_Sfx[(Custom value of Celerity_Target)]
        • Else - Actions
      • Unit Group - Remove Celerity_Target from Celerity_TargetGroup.
3) I don't think this problem exists. I just tested it with two heroes, one with a Level 1 Aura and the other with a Level 5 Aura. All of my units had the Level 5 Aura by default since it's Level is the greatest. Then I moved the Level 5 Hero away, and all of the units lost the Level 5 buff and gained the Level 1 buff.
 

Attachments

  • Celerity Aura v.2.w3m
    24.9 KB · Views: 18
Last edited:
Level 12
Joined
May 16, 2020
Messages
660
On 1): Mmm but how to do this if we constantly remove them from the Group? That's the reason why I went for the option of "checking if unit is still in range > If YES > Do nothing"

On 3): True, they do have Level 1 buff (when you go over with the mouse it shows Level 1), but the attack speed is definitely Level 5. Makes no sense to me either when I look at the trigger, maybe that's how it works internally.
 
Level 12
Joined
May 16, 2020
Messages
660
Thanks Uncle, that works. But if it's not too much to ask: Why does my trigger fail?

(Reminder: If units are affected by Hero A > Hero B comes into Range > Hero B moves out of range > Units are not affected anymore by Hero A)

I don't see why my trigger behaves like this as it should work in my opinion with the CV of the groups. I'd like to understand where the error is...
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,884
Just glancing over it now, I see this in your first Conditions block:
(SearingElements_Caster is alive) Equal to False

Pretty sure you want this to be True.

It also looks like you do nothing to compare the Levels of the auras and you're adding the ability multiple times to the same unit if it comes into contact with 2+ Aura Sources. With this setup it'll always make the most recent Aura the priority, even if it's lower level than the others.

And there is no special effect in those triggers so I'm not sure what you mean when you say "the special effect stays forever".
 
Last edited:
Level 12
Joined
May 16, 2020
Messages
660
Sorry to dig this up again Uncle, but because of the special effect I would really prefer to have a solution where the affected units stay in a group and do not constantly get kicked out/re-added. To show the difference:
  • In your aura you add the effect via trigger and it's the "General Aura Target model" which is subtle and doesn't have a sound.
  • In my aura I add an ability to effected units with an effect and use the effect Abilities\Weapons\AncestralGuardianMissile\AncestralGuardianMissile.mdl, which has a sound
So your solution functionally works, but with my chosen effect it just plays the sound over and over again which is just very annoying. Attached (1) your map with my adjustment to show the sound problem and (2) my map to show you how it ideally should be like (has still bug #1 though)
 

Attachments

  • Land of Legends v0.1.20.w3m
    56.3 MB · Views: 38
  • Celerity Aura v.3_with sound.w3m
    26.9 KB · Views: 24

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,884
Sorry to dig this up again Uncle, but because of the special effect I would really prefer to have a solution where the affected units stay in a group and do not constantly get kicked out/re-added. To show the difference:
  • In your aura you add the effect via trigger and it's the "General Aura Target model" which is subtle and doesn't have a sound.
  • In my aura I add an ability to effected units with an effect and use the effect Abilities\Weapons\AncestralGuardianMissile\AncestralGuardianMissile.mdl, which has a sound
So your solution functionally works, but with my chosen effect it just plays the sound over and over again which is just very annoying. Attached (1) your map with my adjustment to show the sound problem and (2) my map to show you how it ideally should be like (has still bug #1 though)
So remove the effect from the ability and use triggers to add it.

I attached the map with what I think is how you want it to work. The sfx won't be constantly created/destroyed when doing it like this.

And the units shouldn't need to stay in the Unit Group for anything really, you can always check if a unit has the Searing Elements buff to see if it's under the effects of the Aura.

Edit: Forgot to adjust the magic dmg reduction, see v.2
 

Attachments

  • Land of Legends v0.1.20 Searing Elements 2.w3m
    56.3 MB · Views: 23
Last edited:
Status
Not open for further replies.
Top