• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Trigger] Need Help to fix this spell to MUI

Status
Not open for further replies.
Level 14
Joined
Jun 15, 2016
Messages
750
This Blood Aura work perfectly for 1 hero and anyone around him. But if there are 2 heroes of the same type using this spell at the same spot, things go very messy. Please anyone can fix this to MUI so 2 auras can work separated at the same time for 2 heroes? Please use GUI, because i hate Jass. Here is the map i am talking, you guys can check, clean or fix those non-MUI skills or even reduce lags caused by periodically-event skills for good.

Ultimate Battle - Raging Stream v1.1 AI

  • Blood Aura
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Blood Aura
    • Actions
      • Trigger - Turn on Blood Aura Add <gen>
      • Trigger - Turn on Blood Aura Remove <gen>

  • Blood Aura Add
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup=true
      • Unit Group - Pick every unit in (Units within 900.00 of (Position of WarlordU)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Blood Aura ) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Blood Aura for WarlordU) Equal to 3
                • Then - Actions
                  • Unit - Add Blood Life (200) to (Picked unit)
                  • Unit - Remove Blood Life (100) from (Picked unit)
                  • Unit - Remove Blood Life (150) from (Picked unit)
                  • Unit Group - Add (Picked unit) to Group_BloodAura
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Blood Aura for WarlordU) Equal to 2
                • Then - Actions
                  • Unit - Add Blood Life (150) to (Picked unit)
                  • Unit - Remove Blood Life (100) from (Picked unit)
                  • Unit - Remove Blood Life (200) from (Picked unit)
                  • Unit Group - Add (Picked unit) to Group_BloodAura
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Blood Aura for WarlordU) Equal to 1
                • Then - Actions
                  • Unit - Add Blood Life (100) to (Picked unit)
                  • Unit - Remove Blood Life (150) from (Picked unit)
                  • Unit - Remove Blood Life (200) from (Picked unit)
                  • Unit Group - Add (Picked unit) to Group_BloodAura
                • Else - Actions
            • Else - Actions
  • Blood Aura Remove
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Group_BloodAura and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Blood Aura ) Equal to False
            • Then - Actions
              • Unit - Remove Blood Life (150) from (Picked unit)
              • Unit - Remove Blood Life (100) from (Picked unit)
              • Unit - Remove Blood Life (200) from (Picked unit)
              • Unit Group - Remove (Picked unit) from Group_BloodAura
            • Else - Actions
 
Last edited:
Level 14
Joined
Jun 15, 2016
Messages
750
What is the ability supposed to do? What do Blood Life (XY) abilties do? There may be better way to do what you want than swapping 3 different abilities.

WarlordU is a hero-type unit when enter the map. I know using that can be very leaky.

This ability is worked as a aura which can increase Maximum HP to nearby units (using Life+ item ability as the hidden skill and add to all those units)

Ultimate Battle - Raging Stream v1.1 AI

Here is the map i am talking about, you can check all leaking or non-MUI skills in its. If you can fix/clean them or at least show me a solution to a common skill, maybe i can reduce lag of periodical skills and even fix all skills into MUI. You can see that many skills work exactly similarly to each other, some using damage detector. Please if you can fix this, i will give credit, your name to this map and +Rep for you :(. This alter melee must be fixed.
 
Level 41
Joined
Feb 27, 2007
Messages
5,189
Basically you just need to do this to all your currently non-MUI spells: Visualize: Dynamic Indexing

You probably have figured this out with 12 different races but buffs based on the same buff will overwrite each other but never stack, yeah? Just something to know that some spells will cleanse others, for example two of the heroes in the same place won't stack the buff and health bonus. And abilities can only have one buff level so if you want different buffs per level (with the most recent provider of the buff's level) you'll need 3 different aura abilities that provide the buff (all based on the same aura) inside a Disabled Spellbook. You level a dummy ability on the hero. Upon level up remove all 3 and then add the one appropriate for that level; if you store in arrays it'll be much cleaner. Also iterate

you can simplify your trigger by doing:
  • -------- In some initialization trigger --------
  • Set BloodDummy = Dummy hero Blood Aura passive ability
  • Set BloodAura[1] = Blood bonus spellbook #1
  • Set BloodAura[2] = Blood bonus spellbook #2
  • Set BloodAura[3] = Blood bonus spellbook #3
  • Set BloodBonus[1] = Blood bonus life ability #1
  • Set BloodBonus[2] = Blood bonus life ability #2
  • Set BloodBonus[3] = Blood bonus life ability #3
  • Set BloodBuff[1] = Blood buff for aura #1
  • Set BloodBuff[2] = Blood buff for aura #2
  • Set BloodBuff[3] = Blood buff for aura #3
  • Blood Aura
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Blood Aura
    • Actions
      • Set TempU = Triggering Unit
      • Set lvl = Level of (BloodDummy) for TempU
      • Unit - Remove (BloodAura[1]) from (TempU)
      • Unit - Remove (BloodAura[2]) from (TempU)
      • Unit - Remove (BloodAura[3]) from (TempU)
      • Unit - Add (BloodAura[lvl]) to (TempU)
      • If (conditions) then (actions) else (actions)
        • If - Conditions
          • (TempU is in Group_BloodAura) equal to false
        • Then - Actions
          • Unit Group - Add TempU to BloodCasters
        • Else - Actions
      • If (conditions) then (actions) else (actions)
        • If - Conditions
          • Blood aura Add <gen> is off
        • Then - Actions
          • Trigger - Turn on Blood Aura Add <gen>
          • Trigger - Turn on Blood Aura Remove <gen>
        • Else - Actions
  • -------- No bj_wantDestroy --------
  • Unit Group - Pick every unit in Group_BloodAura and do (actions)
    • Loop - Actions
      • Set TempP = Position of (Picked Unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 900.00 of TempP) and do (actions)
        • Loop - Actions
          • Set TempU = (Picked Unit) //I think group recursion works okay here because ForGroup()
          • For each (Integer A) from 1 to 3 do (actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff BloodBuff[(Integer A)]) Equal to True
                  • (Level of (BloodBonus[(Integer A)]) for TempU) equal to 0
                • Then - Actions
                  • Unit - Remove (BloodBonus[1]) from (TempU)
                  • Unit - Remove (BloodBonus[2]) from (TempU)
                  • Unit - Remove (BloodBonus[3]) from (TempU)
                  • Unit - Add (BloodBonus[(Integer A)]) to (TempU)
                  • If (conditions) then (actions) else (actions)
                    • If - Conditions
                      • (TempU is in Group_BloodAura) equal to false
                    • Then - Actions
                      • Unit Group - Add TempU to Group_BloodAura
                    • Else - Actions
                  • Custom script: exitwhen true //to end the 1-3 loop, since there's no need to try any more buffs
  • Blood Aura Remove
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Group_BloodAura and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff BloodBuff[1]) Equal to False
              • ((Picked unit) has buff BloodBuff[2]) Equal to False
              • ((Picked unit) has buff BloodBuff[3]) Equal to False
            • Then - Actions
              • Unit - Remove BloodBonus[1] from (Picked unit)
              • Unit - Remove BloodBonus[2] from (Picked unit)
              • Unit - Remove BloodBonus[3] from (Picked unit)
              • Unit Group - Remove (Picked unit) from Group_BloodAura
            • Else - Actions
 
Level 14
Joined
Jun 15, 2016
Messages
750
S
Basically you just need to do this to all your currently non-MUI spells: Visualize: Dynamic Indexing

You probably have figured this out with 12 different races but buffs based on the same buff will overwrite each other but never stack, yeah? Just something to know that some spells will cleanse others, for example two of the heroes in the same place won't stack the buff and health bonus. And abilities can only have one buff level so if you want different buffs per level (with the most recent provider of the buff's level) you'll need 3 different aura abilities that provide the buff (all based on the same aura) inside a Disabled Spellbook. You level a dummy ability on the hero. Upon level up remove all 3 and then add the one appropriate for that level; if you store in arrays it'll be much cleaner. Also iterate

you can simplify your trigger by doing:
  • -------- In some initialization trigger --------
  • Set BloodDummy = Dummy hero Blood Aura passive ability
  • Set BloodAura[1] = Blood bonus spellbook #1
  • Set BloodAura[2] = Blood bonus spellbook #2
  • Set BloodAura[3] = Blood bonus spellbook #3
  • Set BloodBonus[1] = Blood bonus life ability #1
  • Set BloodBonus[2] = Blood bonus life ability #2
  • Set BloodBonus[3] = Blood bonus life ability #3
  • Set BloodBuff[1] = Blood buff for aura #1
  • Set BloodBuff[2] = Blood buff for aura #2
  • Set BloodBuff[3] = Blood buff for aura #3
  • Blood Aura
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Blood Aura
    • Actions
      • Set TempU = Triggering Unit
      • Set lvl = Level of (BloodDummy) for TempU
      • Unit - Remove (BloodAura[1]) from (TempU)
      • Unit - Remove (BloodAura[2]) from (TempU)
      • Unit - Remove (BloodAura[3]) from (TempU)
      • Unit - Add (BloodAura[lvl]) to (TempU)
      • If (conditions) then (actions) else (actions)
        • If - Conditions
          • (TempU is in Group_BloodAura) equal to false
        • Then - Actions
          • Unit Group - Add TempU to BloodCasters
        • Else - Actions
      • If (conditions) then (actions) else (actions)
        • If - Conditions
          • Blood aura Add <gen> is off
        • Then - Actions
          • Trigger - Turn on Blood Aura Add <gen>
          • Trigger - Turn on Blood Aura Remove <gen>
        • Else - Actions
  • -------- No bj_wantDestroy --------
  • Unit Group - Pick every unit in Group_BloodAura and do (actions)
    • Loop - Actions
      • Set TempP = Position of (Picked Unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 900.00 of TempP) and do (actions)
        • Loop - Actions
          • Set TempU = (Picked Unit) //I think group recursion works okay here because ForGroup()
          • For each (Integer A) from 1 to 3 do (actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff BloodBuff[(Integer A)]) Equal to True
                  • (Level of (BloodBonus[(Integer A)]) for TempU) equal to 0
                • Then - Actions
                  • Unit - Remove (BloodBonus[1]) from (TempU)
                  • Unit - Remove (BloodBonus[2]) from (TempU)
                  • Unit - Remove (BloodBonus[3]) from (TempU)
                  • Unit - Add (BloodBonus[(Integer A)]) to (TempU)
                  • If (conditions) then (actions) else (actions)
                    • If - Conditions
                      • (TempU is in Group_BloodAura) equal to false
                    • Then - Actions
                      • Unit Group - Add TempU to Group_BloodAura
                    • Else - Actions
                  • Custom script: exitwhen true //to end the 1-3 loop, since there's no need to try any more buffs
  • Blood Aura Remove
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Group_BloodAura and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff BloodBuff[1]) Equal to False
              • ((Picked unit) has buff BloodBuff[2]) Equal to False
              • ((Picked unit) has buff BloodBuff[3]) Equal to False
            • Then - Actions
              • Unit - Remove BloodBonus[1] from (Picked unit)
              • Unit - Remove BloodBonus[2] from (Picked unit)
              • Unit - Remove BloodBonus[3] from (Picked unit)
              • Unit Group - Remove (Picked unit) from Group_BloodAura
            • Else - Actions

Something not right with Group_BloodAura :(
Here i make a much more simple version of this spell. Better, but still lag though


Code:
Blood Aura
    Events
        Unit - A unit Learns a skill
    Conditions
        (Learned Hero Skill) Equal to Blood Aura
    Actions
        Trigger - Turn on Blood Aura Add <gen>
        Trigger - Turn on Blood Aura Remove <gen>


Code:
Blood Aura Add
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Custom script:   set bj_wantDestroyGroup=true
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) has buff Blood Aura - Level 1 ) Equal to True
                    Then - Actions
                        Unit - Add Blood Life (100) to (Picked unit)
                        Unit - Remove Blood Life (150) from (Picked unit)
                        Unit - Remove Blood Life (200) from (Picked unit)
                        Unit Group - Add (Picked unit) to Group_BloodAura
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) has buff Blood Aura - Level 2 ) Equal to True
                    Then - Actions
                        Unit - Add Blood Life (150) to (Picked unit)
                        Unit - Remove Blood Life (100) from (Picked unit)
                        Unit - Remove Blood Life (200) from (Picked unit)
                        Unit Group - Add (Picked unit) to Group_BloodAura
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) has buff Blood Aura - Level 3 ) Equal to True
                    Then - Actions
                        Unit - Add Blood Life (200) to (Picked unit)
                        Unit - Remove Blood Life (100) from (Picked unit)
                        Unit - Remove Blood Life (150) from (Picked unit)
                        Unit Group - Add (Picked unit) to Group_BloodAura
                    Else - Actions


Code:
Blood Aura Remove
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in Group_BloodAura and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) has buff Blood Aura - Level 1 ) Equal to False
                        ((Picked unit) has buff Blood Aura - Level 2 ) Equal to False
                        ((Picked unit) has buff Blood Aura - Level 3 ) Equal to False
                    Then - Actions
                        Unit - Remove Blood Life (150) from (Picked unit)
                        Unit - Remove Blood Life (100) from (Picked unit)
                        Unit - Remove Blood Life (200) from (Picked unit)
                        Unit Group - Remove (Picked unit) from Group_BloodAura
                    Else - Actions
 
Last edited:
Level 41
Joined
Feb 27, 2007
Messages
5,189
It's laggy because you're picking every unit in the map and iterating over them once per second. That's why I introduced that group.

Good trigger practice: add Turn off (this trigger) to the on hero learn trigger at the end. It only needs to run once.

And you could further combine your two triggers that go every 1 second into one trigger that goes every 1 second, just literally paste the actions down at the bottom.
 
Last edited by a moderator:
The problem goes with buff being never stack (1) and the fact that this is an aura (2).

If both aura meant to combine, then you need to make the buff differs for each level this ability goes. As far as it goes, this allows stacks for different level.
Harder case goes to stack at same level.

This is for stacking the effect.
 
Status
Not open for further replies.
Top