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

[Spell] Altering a buff without changing the duration?

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

I want to create a spell which adds x% speed to a hero upon casting a single target spell. The speed can stack with itself and is based on how many enemies are currently affected by the spell. If less units are affected by the spell, the speed bonus should reduce. Essentially, it is Axe's Battle Hunger from Dota2:
Axe

My idea was the following:
- Upon casting the spell, the trigger checks how many units are in Group X
- The # of units in Group X determine the ability level of the speed ability (higher level = higher speed)
- Upon condition Y, which removes 1 unit from Group X, the buff should be altered to provide -1 level of the speed (I can't re-cast it with the adjusted level, otherwise the speed duration would re-new itself, which should not happen)

Is there a way to alter a buff once placed, without changing the duration? Or is there a better way to implement it?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
Do you want the ability to be MUI? Or will only 1 Hero use this spell.

And my idea is to make the buff last forever and manually remove the buff yourself with triggers. This way it wouldn't matter if you re-apply the buff, since it'll get removed at the same time regardless.

Edit:
I attached a map with a non-MUI example.
  • Battle Hunger Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Set the Speed to a negative value since we're reversing the effects of Slow --------
      • Set VariableSet BattleH_Speed[1] = -0.05
      • Set VariableSet BattleH_Speed[2] = -0.10
      • Set VariableSet BattleH_Speed[3] = -0.15
      • Set VariableSet BattleH_Speed[4] = -0.20
  • Cast Battle Hunger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Battle Hunger (Hero - Damage)
    • Actions
      • Set VariableSet BattleH_Caster = (Triggering unit)
      • -------- --------
      • -------- Add To Group --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in BattleH_Group.) Equal to False
        • Then - Actions
          • Unit Group - Add (Target unit of ability being cast) to BattleH_Group
        • Else - Actions
      • Set VariableSet BattleH_Delay[(Custom value of (Target unit of ability being cast))] = 1
      • -------- --------
      • -------- Dummy --------
      • Set VariableSet Level = (Level of (Ability being cast) for (Triggering unit))
      • Set VariableSet TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 Dummy for (Triggering player) at TempPoint facing Default building facing degrees
      • Unit - Add Battle Hunger (Dummy - Speed) to (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_TempPoint)
      • -------- --------
      • Ability - Set Ability: (Unit: (Last created unit)'s Ability with Ability Code: Battle Hunger (Dummy - Speed))'s Real Level Field: Movement Speed Factor ('Slo1') of Level: 0 to (BattleH_Speed[Level] x (Real((Number of units in BattleH_Group))))
      • Unit - Order (Last created unit) to Human Sorceress - Slow (Triggering unit)
      • -------- --------
      • -------- Start Loop --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Battle Hunger Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Battle Hunger Loop <gen>
        • Else - Actions
  • Battle Hunger Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- Check Loop --------
      • Unit Group - Pick every unit in BattleH_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BattleH_Delay[(Custom value of (Picked unit))] Equal to 0
              • ((Picked unit) has buff Battle Hunger (Damage)) Equal to False
            • Then - Actions
              • Unit Group - Remove (Picked unit) from BattleH_Group.
              • -------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in BattleH_Group) Equal to 0
                • Then - Actions
                  • Unit - Remove Battle Hunger (Speed) buff from BattleH_Caster
                  • Trigger - Turn off (This trigger)
                • Else - Actions
                  • -------- Dummy --------
                  • Set VariableSet Level = (Level of Battle Hunger (Hero - Damage) for BattleH_Caster)
                  • Set VariableSet TempPoint = (Position of BattleH_Caster)
                  • Unit - Create 1 Dummy for (Owner of BattleH_Caster) at TempPoint facing Default building facing degrees
                  • Unit - Add Battle Hunger (Dummy - Speed) to (Last created unit)
                  • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                  • Custom script: call RemoveLocation (udg_TempPoint)
                  • -------- --------
                  • Ability - Set Ability: (Unit: (Last created unit)'s Ability with Ability Code: Battle Hunger (Dummy - Speed))'s Real Level Field: Movement Speed Factor ('Slo1') of Level: 0 to (BattleH_Speed[Level] x (Real((Number of units in BattleH_Group))))
                  • Unit - Order (Last created unit) to Human Sorceress - Slow BattleH_Caster
            • Else - Actions
              • Set VariableSet BattleH_Delay[(Custom value of (Picked unit))] = 0
BattleH_Delay is used to compensate for the fact that we're using Acid Bomb (a non-instant missile based ability), which takes a short moment to apply it's buff. The delay guarantees that at least 0.03 seconds has passed before it checks if the target has the Battle Hunger buff (giving it sufficient time to receive the buff).
 

Attachments

  • Battle Hunger 1.w3m
    26.1 KB · Views: 41
Last edited:
Level 8
Joined
Mar 19, 2017
Messages
248
You will need a buff system man. You can't level/unlevel a buff once is placed and you can retrieve almost not relevant data about them (unless you make your buff system). You can only remove them. But abilities can be leveled.
Regarding this you can make your spell behave like a temporal ability placer. Since you are concerned about move speed you could use ie. endurance aura/tornado slow (with negative values). You cast the spell on a unit and you add the aura ability if it is the first cast. Otherwise you update either its level or its ability field data (recquires latest version). You then need a periodic check of the conditions you want, including the duration of the buff as temporal abilities don't exist in the object editor. If the duration ends (you may retrieve this data with hashtables or a unit indexer), you remove the aura ability and the buff placed by the aura. In this periodic trigger you could (again, if you use latest versions), instead of constantly increasing or decreasing levels, use the new natives that modify ability fields (more precise method, and you just need one level).
 
Level 12
Joined
May 16, 2020
Messages
660
Thank you all for the answers - I think Uncle's solution is perfect.

Do you want the ability to be MUI? Or will only 1 Hero use this spell.

And my idea is to make the buff last forever and manually remove the buff yourself with triggers. This way it wouldn't matter if you re-apply the buff, since it'll get removed at the same time regardless.

Edit:
I attached a map with a non-MUI example.
  • Battle Hunger Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Set the Speed to a negative value since we're reversing the effects of Slow --------
      • Set VariableSet BattleH_Speed[1] = -0.05
      • Set VariableSet BattleH_Speed[2] = -0.10
      • Set VariableSet BattleH_Speed[3] = -0.15
      • Set VariableSet BattleH_Speed[4] = -0.20
  • Cast Battle Hunger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Battle Hunger (Hero - Damage)
    • Actions
      • Set VariableSet BattleH_Caster = (Triggering unit)
      • -------- --------
      • -------- Add To Group --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in BattleH_Group.) Equal to False
        • Then - Actions
          • Unit Group - Add (Target unit of ability being cast) to BattleH_Group
        • Else - Actions
      • Set VariableSet BattleH_Delay[(Custom value of (Target unit of ability being cast))] = 1
      • -------- --------
      • -------- Dummy --------
      • Set VariableSet Level = (Level of (Ability being cast) for (Triggering unit))
      • Set VariableSet TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 Dummy for (Triggering player) at TempPoint facing Default building facing degrees
      • Unit - Add Battle Hunger (Dummy - Speed) to (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_TempPoint)
      • -------- --------
      • Ability - Set Ability: (Unit: (Last created unit)'s Ability with Ability Code: Battle Hunger (Dummy - Speed))'s Real Level Field: Movement Speed Factor ('Slo1') of Level: 0 to (BattleH_Speed[Level] x (Real((Number of units in BattleH_Group))))
      • Unit - Order (Last created unit) to Human Sorceress - Slow (Triggering unit)
      • -------- --------
      • -------- Start Loop --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Battle Hunger Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Battle Hunger Loop <gen>
        • Else - Actions
  • Battle Hunger Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- Check Loop --------
      • Unit Group - Pick every unit in BattleH_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BattleH_Delay[(Custom value of (Picked unit))] Equal to 0
              • ((Picked unit) has buff Battle Hunger (Damage)) Equal to False
            • Then - Actions
              • Unit Group - Remove (Picked unit) from BattleH_Group.
              • -------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in BattleH_Group) Equal to 0
                • Then - Actions
                  • Unit - Remove Battle Hunger (Speed) buff from BattleH_Caster
                  • Trigger - Turn off (This trigger)
                • Else - Actions
                  • -------- Dummy --------
                  • Set VariableSet Level = (Level of Battle Hunger (Hero - Damage) for BattleH_Caster)
                  • Set VariableSet TempPoint = (Position of BattleH_Caster)
                  • Unit - Create 1 Dummy for (Owner of BattleH_Caster) at TempPoint facing Default building facing degrees
                  • Unit - Add Battle Hunger (Dummy - Speed) to (Last created unit)
                  • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                  • Custom script: call RemoveLocation (udg_TempPoint)
                  • -------- --------
                  • Ability - Set Ability: (Unit: (Last created unit)'s Ability with Ability Code: Battle Hunger (Dummy - Speed))'s Real Level Field: Movement Speed Factor ('Slo1') of Level: 0 to (BattleH_Speed[Level] x (Real((Number of units in BattleH_Group))))
                  • Unit - Order (Last created unit) to Human Sorceress - Slow BattleH_Caster
            • Else - Actions
              • Set VariableSet BattleH_Delay[(Custom value of (Picked unit))] = 0
BattleH_Delay is used to compensate for the fact that we're using Acid Bomb (a non-instant missile based ability), which takes a short moment to apply it's buff. The delay guarantees that at least 0.03 seconds has passed before it checks if the target has the Battle Hunger buff (giving it sufficient time to receive the buff).

Thanks Uncle! A few questions:
  • I haven't used an Indexer before, but I guess you use it to ensure that all units have a different Custom values?
  • It's probably long overdue that I add an Indexer to my map, but it means that I will need to adjust triggers which use "set unit custom value to x", correct?
  • In the Loop trigger you use
    • BattleH_Delay[(Custom value of (Picked unit))] Equal to 0
    Is this the same as "unit is dead"?
  • Can you please make it MUI? A direct comparison between non-MUI and MUI would be great, I still struggle applying the info you shared once in practice.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
Thank you all for the answers - I think Uncle's solution is perfect.



Thanks Uncle! A few questions:
  • I haven't used an Indexer before, but I guess you use it to ensure that all units have a different Custom values?
  • It's probably long overdue that I add an Indexer to my map, but it means that I will need to adjust triggers which use "set unit custom value to x", correct?
  • In the Loop trigger you use
    • BattleH_Delay[(Custom value of (Picked unit))] Equal to 0
    Is this the same as "unit is dead"?
  • Can you please make it MUI? A direct comparison between non-MUI and MUI would be great, I still struggle applying the info you shared once in practice.
1) There's already a Unit Indexer in your map, I took advantage of it in that Chronosphere trigger and probably even Shockwave.

2) BattleH_Delay is used to delay the Loop from checking if an enemy has the Battle Hunger buff (it delays it by 1 cycle). This is to compensate for the fact that Acid Bomb (what I was using to apply Battle Hunger) has a delay before it's buff is applied. Without BattleH_Delay, the units will be removed from the Unit Group prematurely as the units will not have the buff yet.

I'm leaving it up to you to make it MUI, but i'll lead you in the right direction. Right now it's using one Unit Group to contain the enemies affected by Battle Hunger. For MUI, you need multiple Unit Groups (an Array). You want to use the Caster's custom value as the Index for these Unit Groups.

Then you use the Unit Indexer to link the target(s) of Battle Hunger to their source of Battle Hunger (Caster).

Why do this:

If you target an enemy with Battle Hunger, and your Ally casts Battle Hunger on that same target, it will change the source of the effect. The most recent cast of Battle Hunger will take precedence. Warcraft 3's buff system will handle that for us, but we still need to manage our Unit Groups/Speed buff stuff. So we need to remove the Target from the original Caster's Unit Group and add it to the new Caster's Unit Group.

So it's quite simple, you're using the Unit Indexer to keep track of the most recent Caster on each enemy affected by Battle Hunger.

We will then need to check if the Target is already linked to another Caster, and if it is, remove it from that Caster's Unit Group and re-apply that Caster's Battle Hunger (Speed) buff since it's speed will have been reduced by 1 unit. So at the start of the Battle Hunger Cast trigger it will look something like this:

  • Set BH_CV = custom value of Target unit of ability being cast
  • -
  • If BH_Caster[BH_CV] NOT equal to No Unit AND BH_Caster[BH_CV] Not equal to Casting unit then
  • Remove Target unit of ability being cast from BH_Group[custom value of BH_Caster[BH_CV]]
  • --- Update BH_Caster[BH_CV]'s movement speed since it just lost a target ---
  • -
  • --- Then below/outside of the If Then Else ---
  • Set BH_Caster[BH_CV] = Casting unit
  • Add Target unit of ability being cast to BH_Group[custom value of Casting unit]
  • -
  • --- Then proceed with what will basically remain the same -> Create Dummy / Cast Battle Hunger on Caster / Turn On Loop / Etc ---
If a Target dies/loses the buff inside the Loop trigger, make sure to unlink it from it's current Caster:
  • Set BH_Caster[custom value of Picked unit] = No Unit
This way the Cast Trigger doesn't try to remove it from an existing group.

You'll also want to initialize (create) the Unit Groups yourself with Custom Script:
  • Set BH_Caster_CV = custom value of Casting unit
  • Custom script: If udg_BH_Group[udg_BH_Caster_CV] == null then
  • Custom script: Set udg_BH_Group[udg_BH_Caster_CV] = CreateGroup()
  • Custom script: endif
 
Last edited:
Level 12
Joined
May 16, 2020
Messages
660
Hi Uncle, sorry I'm really confused about adding the "same unit targeted" condition.

Is it correct that we have 2 Groups (one for the Caster_CV and one for the Target_CV), and each one has an array which corresponds to the index?

The Caster_CV group would make makes sense to me, because I can link the units affected by Caster A back to Caster A. But in your last instructions I just see the mention about "Target_CV", which I guess I understand (it tells us if Caster A and B target the same unit), but this means I'd need to define the Caster x2 within the same trigger...?

This is what I have so far:

The first one is now a bit messed after trying to include the "same unit" condition:
  • Cast Battle Hunger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Battle Hunger
    • Actions
      • Set VariableSet BattleH_Index = (BattleH_Index + 1)
      • Set VariableSet BattleH_Caster[BattleH_Index] = (Triggering unit)
      • Set VariableSet BattleH_Target = (Target unit of ability being cast)
      • Set VariableSet BattleH_Caster_CV = (Custom value of BattleH_Caster[BattleH_Index])
      • Set VariableSet BattleH_Target_CV = (Custom value of BattleH_Target)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • BattleH_Caster[BattleH_Target_CV] Not equal to No unit
              • BattleH_Caster[BattleH_Target_CV] Not equal to (Triggering unit)
        • Then - Actions
          • Unit Group - Remove BattleH_Target from BattleH_Group[BattleH_Target_CV].
        • Else - Actions
      • Set VariableSet BattleH_Caster[BattleH_Target_CV] = (Triggering unit)
      • Unit Group - Add BattleH_Target to BattleH_Group[BattleH_Caster_CV]
      • -------- --------
      • -------- Create Group if non-existing --------
      • Custom script: if udg_BattleH_Group[udg_BattleH_CV] == null then
      • Custom script: set udg_BattleH_Group[udg_BattleH_CV] = CreateGroup()
      • Custom script: endif
      • -------- Add To Group --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (BattleH_Target is in BattleH_Group[BattleH_Caster_CV].) Equal to False
        • Then - Actions
          • Unit Group - Add BattleH_Target to BattleH_Group[BattleH_Caster_CV]
        • Else - Actions
      • Set VariableSet BattleH_Delay[(Custom value of BattleH_Target)] = 1
      • -------- --------
      • -------- Dummy --------
      • Set VariableSet BattleH_Level = (Level of (Ability being cast) for BattleH_Caster[BattleH_Index])
      • Set VariableSet BattleH_TempPoint = (Position of BattleH_Caster[BattleH_Index])
      • Unit - Create 1 Dummy (Ground/Speed 0) for (Owner of BattleH_Caster[BattleH_Index]) at BattleH_TempPoint facing Default building facing degrees
      • Unit - Add Battle Hunger (Speed) to (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_BattleH_TempPoint)
      • -------- --------
      • Ability - Set Ability: (Unit: (Last created unit)'s Ability with Ability Code: Battle Hunger (Speed))'s Real Level Field: Movement Speed Reduction (%) ('Nab1') of Level: 0 to (BattleH_Speed[BattleH_Level] x (Real((Number of units in BattleH_Group[BattleH_Caster_CV]))))
      • Unit - Order (Last created unit) to Neutral Alchemist - Acid Bomb BattleH_Caster[BattleH_Index]
      • -------- --------
      • -------- Start Loop --------
      • Game - Display to (All players) the text: (String(BattleH_Index))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BattleH_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Battle Hunger Loop <gen>
          • Trigger - Turn on Battle Hunger Kill <gen>
        • Else - Actions
  • Battle Hunger Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer BattleH_Loop) from 1 to BattleH_Index, do (Actions)
        • Loop - Actions
          • Set VariableSet BattleH_Caster_CV = (Custom value of BattleH_Caster[BattleH_Loop])
          • Set VariableSet BattleH_Level = (Level of Battle Hunger for BattleH_Caster[BattleH_Loop])
          • Unit Group - Pick every unit in BattleH_Group[BattleH_Caster_CV] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • BattleH_Delay[(Custom value of (Picked unit))] Equal to 0
                  • Or - Any (Conditions) are true
                    • Conditions
                      • ((Picked unit) is alive) Equal to False
                      • ((Picked unit) has buff Battle Hunger (Slow)) Equal to False
                • Then - Actions
                  • Unit Group - Remove (Picked unit) from BattleH_Group[BattleH_Caster_CV].
                  • Set VariableSet BattleH_Index = (BattleH_Index - 1)
                  • Game - Display to (All players) the text: (String(BattleH_Index))
                  • -------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in BattleH_Group[BattleH_Caster_CV]) Equal to 0
                    • Then - Actions
                      • Unit - Remove Battle Hunger (Speed) buff from BattleH_Caster[BattleH_Loop]
                      • Custom script: call DestroyGroup (udg_BattleH_Group[udg_BattleH_CV])
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • BattleH_Index Equal to 0
                        • Then - Actions
                          • Game - Display to (All players) the text: Trigger turned off
                          • Trigger - Turn off Battle Hunger Kill <gen>
                          • Trigger - Turn off (This trigger)
                        • Else - Actions
                    • Else - Actions
                      • Game - Display to (All players) the text: (String((Number of units in BattleH_Group[BattleH_Caster_CV])))
                      • -------- Dummy --------
                      • Set VariableSet BattleH_Level = (Level of Battle Hunger for BattleH_Caster[BattleH_Loop])
                      • Set VariableSet BattleH_TempPoint = (Position of BattleH_Caster[BattleH_Loop])
                      • Unit - Create 1 Dummy (Ground/Speed 0) for (Owner of BattleH_Caster[BattleH_Loop]) at BattleH_TempPoint facing Default building facing degrees
                      • Unit - Add Battle Hunger (Speed) to (Last created unit)
                      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation (udg_BattleH_TempPoint)
                      • -------- --------
                      • Ability - Set Ability: (Unit: (Last created unit)'s Ability with Ability Code: Battle Hunger (Speed))'s Real Level Field: Movement Speed Reduction (%) ('Nab1') of Level: 0 to (BattleH_Speed[BattleH_Level] x (Real((Number of units in BattleH_Group[BattleH_Caster_CV]))))
                      • Unit - Order (Last created unit) to Neutral Alchemist - Acid Bomb BattleH_Caster[BattleH_Loop]
                • Else - Actions
                  • Set VariableSet BattleH_Delay[(Custom value of (Picked unit))] = 0
  • Battle Hunger Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) has buff Battle Hunger (Slow)) Equal to True
    • Actions
      • Unit - Remove Battle Hunger (Slow) buff from (Killing unit)

(from what I tested it works as long as my casters target different units)
 
Level 12
Joined
May 16, 2020
Messages
660
But then how does this part make sense?:

  • Remove Target unit of ability being cast from BH_Group[custom value of BH_Caster[BH_CV]]
This is group which I never use (at least I don't see the part where targets would be added there). The targets are only added to BH_Group[custom value of casting unit]. Shouldn't it be?:

  • Remove Target unit of ability being cast from BH_Group[udg_BH_Caster_CV]
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
Edit:
The first one is using the Target's linked Caster custom value (custom value of BH_Caster[BH_CV]), the second one is using the current Caster's custom value (BH_Caster_CV).

You only need 1 Unit Group with an Array. The caster's custom value is used as the index.

When you target a unit with the ability, we check to see if it already belongs to another caster's Unit Group, if it does, we remove it from that.

This is so that the unit is only ever in 1 Unit Group at a time.

If you do exactly what I said it will work!
 
Last edited:
Level 12
Joined
May 16, 2020
Messages
660
Hi Uncle, so I think I understand the first part and implemented it as you said:

  • Cast Battle Hunger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Battle Hunger
    • Actions
      • Set VariableSet BattleH_Index = (BattleH_Index + 1)
      • Set VariableSet BattleH_Target = (Target unit of ability being cast)
      • Set VariableSet BattleH_Target_CV = (Custom value of BattleH_Target)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BattleH_Caster[BattleH_Target_CV] Not equal to No unit
          • BattleH_Caster[BattleH_Target_CV] Not equal to (Casting unit)
        • Then - Actions
          • Unit Group - Remove BattleH_Target from BattleH_Group[(Custom value of BattleH_Caster[BattleH_Target_CV])].
          • -------- Update BH_Caster[BH_CV]'s movement speed since it just lost a target --------
          • Unit - Remove Battle Hunger (Speed) buff from BattleH_Caster[BattleH_Target_CV]
        • Else - Actions
      • Set VariableSet BattleH_Caster[BattleH_Target_CV] = (Casting unit)
      • -------- --------
      • -------- Create Group if non-existing --------
      • Set VariableSet BattleH_Caster_CV = (Custom value of (Casting unit))
      • Custom script: if udg_BattleH_Group[udg_BattleH_Caster_CV] == null then
      • Custom script: set udg_BattleH_Group[udg_BattleH_Caster_CV] = CreateGroup()
      • Custom script: endif
      • -------- --------
      • -------- ADD TARGET TO GROUP [CV_CASTER] --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (BattleH_Target is in BattleH_Group[BattleH_Caster_CV].) Equal to False
        • Then - Actions
          • Unit Group - Add BattleH_Target to BattleH_Group[BattleH_Caster_CV]
        • Else - Actions
      • Set VariableSet BattleH_Delay[(Custom value of BattleH_Target)] = 1
      • -------- --------
      • -------- Dummy --------
      • Set VariableSet BattleH_Level = (Level of (Ability being cast) for BattleH_Caster[BattleH_Target_CV])
      • Set VariableSet BattleH_TempPoint = (Position of BattleH_Caster[BattleH_Target_CV])
      • Unit - Create 1 Dummy (Ground/Speed 0) for (Owner of BattleH_Caster[BattleH_Target_CV]) at BattleH_TempPoint facing Default building facing degrees
      • Unit - Add Battle Hunger (Speed) to (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Ability - Set Ability: (Unit: (Last created unit)'s Ability with Ability Code: Battle Hunger (Speed))'s Real Level Field: Movement Speed Reduction (%) ('Nab1') of Level: 0 to (BattleH_Speed[BattleH_Level] x (Real((Number of units in BattleH_Group[BattleH_Caster_CV]))))
      • Unit - Order (Last created unit) to Neutral Alchemist - Acid Bomb BattleH_Caster[BattleH_Target_CV]
      • Custom script: call RemoveLocation (udg_BattleH_TempPoint)
      • -------- --------
      • -------- Start Loop --------
      • Game - Display to (All players) the text: (String(BattleH_Index))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BattleH_Index Equal to 1
        • Then - Actions
          • Game - Display to (All players) the text: Trigger ON
          • Trigger - Turn on Battle Hunger Loop <gen>
          • Trigger - Turn on Battle Hunger Kill <gen>
        • Else - Actions

But now the following challenge:
The below trigger is based on the Dynamic Indexing Guide you once shared with me. Since the BH_Groups are now based on Caster_CV - not index! - how can I make the connection between the two triggers...?

In your explanation above there was nothing about Index, but I will need this, right...?

  • Battle Hunger Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer BattleH_Loop) from 1 to BattleH_Index, do (Actions)
        • Loop - Actions
          • Set VariableSet BattleH_Caster_CV = (Custom value of BattleH_Caster[BattleH_Loop])
          • Set VariableSet BattleH_Level = (Level of Battle Hunger for BattleH_Caster[BattleH_Loop])
          • Unit Group - Pick every unit in BattleH_Group[BattleH_Caster_CV] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • BattleH_Delay[(Custom value of (Picked unit))] Equal to 0
                  • Or - Any (Conditions) are true
                    • Conditions
                      • ((Picked unit) is alive) Equal to False
                      • ((Picked unit) has buff Battle Hunger (Slow)) Equal to False
                • Then - Actions
                  • Set VariableSet BattleH_Caster[(Custom value of (Picked unit))] = No unit
                  • Unit Group - Remove (Picked unit) from BattleH_Group[BattleH_Caster_CV].
                  • Set VariableSet BattleH_Index = (BattleH_Index - 1)
                  • Game - Display to (All players) the text: (String(BattleH_Index))
                  • -------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in BattleH_Group[BattleH_Caster_CV]) Equal to 0
                    • Then - Actions
                      • Unit - Remove Battle Hunger (Speed) buff from BattleH_Caster[BattleH_Loop]
                      • Custom script: call DestroyGroup (udg_BattleH_Group[udg_BattleH_Caster_CV])
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • BattleH_Index Equal to 0
                        • Then - Actions
                          • Game - Display to (All players) the text: Trigger OFF
                          • Trigger - Turn off Battle Hunger Kill <gen>
                          • Trigger - Turn off (This trigger)
                        • Else - Actions
                    • Else - Actions
                      • Game - Display to (All players) the text: (String((Number of units in BattleH_Group[BattleH_Caster_CV])))
                      • -------- Dummy --------
                      • Set VariableSet BattleH_Level = (Level of Battle Hunger for BattleH_Caster[BattleH_Loop])
                      • Set VariableSet BattleH_TempPoint = (Position of BattleH_Caster[BattleH_Loop])
                      • Unit - Create 1 Dummy (Ground/Speed 0) for (Owner of BattleH_Caster[BattleH_Loop]) at BattleH_TempPoint facing Default building facing degrees
                      • Unit - Add Battle Hunger (Speed) to (Last created unit)
                      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation (udg_BattleH_TempPoint)
                      • -------- --------
                      • Ability - Set Ability: (Unit: (Last created unit)'s Ability with Ability Code: Battle Hunger (Speed))'s Real Level Field: Movement Speed Reduction (%) ('Nab1') of Level: 0 to (BattleH_Speed[BattleH_Level] x (Real((Number of units in BattleH_Group[BattleH_Caster_CV]))))
                      • Unit - Order (Last created unit) to Neutral Alchemist - Acid Bomb BattleH_Caster[BattleH_Loop]
                • Else - Actions
                  • Set VariableSet BattleH_Delay[(Custom value of (Picked unit))] = 0
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
All of the needed information is linked to the casters, so as long as you have reference to them you're set. I would use another Unit Group to contain these Casters, since you don't want to reference a caster more than once each interval.

Like:
Every 0.03 seconds
Pick every unit in BattleH_Caster_Group (this new group contains the casters) ->
Set BattleH_Caster_CV = Custom value of picked unit
Pick every unit in BattleH_Group[BattleH_Caster_CV] ->
You now have access to every unit that is currently affected by the caster's Battle Hunger.
 
Level 12
Joined
May 16, 2020
Messages
660
Mmm almost there I think, but there is still a bug:
  • When Caster A casts Battle Hunger on 2 units (Speedboost 24%), and Caster B casts it on one of these targets, the speed is supposed to be equal between Caster A (12%) and B (12%).
  • Instead, Caster A loses all speed (0%) and Caster B gets the expected speedboost of 12%.
Spent all morning trying to find the bug, but I really don't see it... this is honestly the hardest trigger I have ever done.

And I had to do an adjustment regarding this, for some reason it simply doesn't recognize if the group is empty (the GUI version does however):

  • Custom script: if udg_BattleH_Group[udg_BattleH_Caster_CV] == null then
  • Custom script: set udg_BattleH_Group[udg_BattleH_Caster_CV] = CreateGroup()
  • Custom script: endif
***

  • Cast Battle Hunger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Battle Hunger
    • Actions
      • Set VariableSet BattleH_Target = (Target unit of ability being cast)
      • Set VariableSet BattleH_Target_CV = (Custom value of BattleH_Target)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BattleH_Caster[BattleH_Target_CV] Not equal to No unit
          • BattleH_Caster[BattleH_Target_CV] Not equal to (Triggering unit)
        • Then - Actions
          • Unit Group - Remove BattleH_Target from BattleH_Group[(Custom value of BattleH_Caster[BattleH_Target_CV])].
          • -------- Update BH_Caster[BH_CV]'s movement speed since it just lost a target --------
          • Unit - Remove Battle Hunger (Speed) buff from BattleH_Caster[BattleH_Target_CV]
          • -------- REMOVE OLD CASTER FROM CASTER GROUP --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in BattleH_Group[(Custom value of BattleH_Caster[BattleH_Target_CV])]) Equal to 0
            • Then - Actions
              • Unit Group - Remove BattleH_TempCaster from BattleH_GroupCaster.
              • Game - Display to (All players) the text: (Units left in Caster group: + (String((Number of units in BattleH_GroupCaster))))
            • Else - Actions
        • Else - Actions
      • Set VariableSet BattleH_Caster[BattleH_Target_CV] = (Triggering unit)
      • Set VariableSet BattleH_Caster_CV = (Custom value of BattleH_Caster[BattleH_Target_CV])
      • -------- --------
      • -------- ADD CASTER TO CASTER GROUP --------
      • Unit Group - Add BattleH_Caster[BattleH_Target_CV] to BattleH_GroupCaster
      • Game - Display to (All players) the text: (Units in Caster group: + (String((Number of units in BattleH_GroupCaster))))
      • -------- --------
      • -------- Create Group if non-existing --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in BattleH_Group[BattleH_Caster_CV]) Equal to 0
        • Then - Actions
          • Custom script: set udg_BattleH_Group[udg_BattleH_Caster_CV] = CreateGroup()
        • Else - Actions
      • -------- --------
      • -------- ADD TARGET TO GROUP [CV_CASTER] --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (BattleH_Target is in BattleH_Group[BattleH_Caster_CV].) Equal to False
        • Then - Actions
          • Unit Group - Add BattleH_Target to BattleH_Group[BattleH_Caster_CV]
        • Else - Actions
      • Game - Display to (All players) the text: (Units in Target group: + (String((Number of units in BattleH_Group[BattleH_Caster_CV]))))
      • Set VariableSet BattleH_Delay[(Custom value of BattleH_Target)] = 1
      • -------- --------
      • -------- UPDATE SPEED --------
      • Set VariableSet BattleH_Level = (Level of Battle Hunger for BattleH_Caster[BattleH_Target_CV])
      • Set VariableSet BattleH_TempPoint = (Position of BattleH_Caster[BattleH_Target_CV])
      • Unit - Create 1 Dummy (Ground/Speed 0) for (Owner of BattleH_Caster[BattleH_Target_CV]) at BattleH_TempPoint facing Default building facing degrees
      • Unit - Add Battle Hunger (Speed) to (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Ability - Set Ability: (Unit: (Last created unit)'s Ability with Ability Code: Battle Hunger (Speed))'s Real Level Field: Movement Speed Reduction (%) ('Nab1') of Level: 0 to (BattleH_Speed[BattleH_Level] x (Real((Number of units in BattleH_Group[BattleH_Caster_CV]))))
      • Unit - Order (Last created unit) to Neutral Alchemist - Acid Bomb BattleH_Caster[BattleH_Target_CV]
      • Custom script: call RemoveLocation (udg_BattleH_TempPoint)
      • -------- --------
      • -------- START LOOP --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in BattleH_GroupCaster) Equal to 1
        • Then - Actions
          • Game - Display to (All players) the text: Loop ON
          • Trigger - Turn on Battle Hunger Loop <gen>
          • Trigger - Turn on Battle Hunger Kill <gen>
        • Else - Actions


  • Battle Hunger Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in BattleH_GroupCaster and do (Actions)
        • Loop - Actions
          • Set VariableSet BattleH_TempCaster = (Picked unit)
          • Set VariableSet BattleH_Caster_CV = (Custom value of BattleH_TempCaster)
          • Set VariableSet BattleH_Level = (Level of Battle Hunger for BattleH_TempCaster)
          • Unit Group - Pick every unit in BattleH_Group[BattleH_Caster_CV] and do (Actions)
            • Loop - Actions
              • Set VariableSet BattleH_TempTarget = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • BattleH_Delay[(Custom value of BattleH_TempTarget)] Equal to 0
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (BattleH_TempTarget is alive) Equal to False
                      • (BattleH_TempTarget has buff Battle Hunger (Slow)) Equal to False
                • Then - Actions
                  • Set VariableSet BattleH_Caster[(Custom value of BattleH_TempTarget)] = No unit
                  • Unit Group - Remove BattleH_TempTarget from BattleH_Group[BattleH_Caster_CV].
                  • -------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in BattleH_Group[BattleH_Caster_CV]) Equal to 0
                    • Then - Actions
                      • Unit - Remove Battle Hunger (Speed) buff from BattleH_TempCaster
                      • Unit Group - Remove BattleH_TempCaster from BattleH_GroupCaster.
                      • Game - Display to (All players) the text: (Units left in Caster group: + (String((Number of units in BattleH_GroupCaster))))
                      • Game - Display to (All players) the text: (Units left in Target group: + (String((Number of units in BattleH_Group[BattleH_Caster_CV]))))
                      • Game - Display to (All players) the text: Destroying BattleH_...
                      • Custom script: call DestroyGroup (udg_BattleH_Group[udg_BattleH_Caster_CV])
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in BattleH_GroupCaster) Equal to 0
                        • Then - Actions
                          • Game - Display to (All players) the text: Loop OFF
                          • Trigger - Turn off Battle Hunger Kill <gen>
                          • Trigger - Turn off (This trigger)
                        • Else - Actions
                    • Else - Actions
                      • Game - Display to (All players) the text: (Units left in Target group: + (String((Number of units in BattleH_Group[BattleH_Caster_CV]))))
                      • -------- UPDATE SPEED --------
                      • Set VariableSet BattleH_TempPoint = (Position of BattleH_TempCaster)
                      • Unit - Create 1 Dummy (Ground/Speed 0) for (Owner of BattleH_TempCaster) at BattleH_TempPoint facing Default building facing degrees
                      • Set VariableSet BattleH_Dummy = (Last created unit)
                      • Unit - Add Battle Hunger (Speed) to BattleH_Dummy
                      • Ability - Set Ability: (Unit: BattleH_Dummy's Ability with Ability Code: Battle Hunger (Speed))'s Real Level Field: Movement Speed Reduction (%) ('Nab1') of Level: 0 to (BattleH_Speed[BattleH_Level] x (Real((Number of units in BattleH_Group[BattleH_Caster_CV]))))
                      • Game - Display to (All players) the text: (Speed Update: + (String((BattleH_Speed[BattleH_Level] x (Real((Number of units in BattleH_Group[BattleH_Caster_CV])))))))
                      • Unit - Order BattleH_Dummy to Neutral Alchemist - Acid Bomb BattleH_TempCaster
                      • Unit - Add a 0.50 second Generic expiration timer to BattleH_Dummy
                      • Custom script: call RemoveLocation (udg_BattleH_TempPoint)
                • Else - Actions
                  • Set VariableSet BattleH_Delay[(Custom value of BattleH_TempTarget)] = 0
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
I don't see where you're ordering the Dummy to cast the Speed buff on the Caster. It looks like you only order it to cast Acid Bomb on the Target.

My setup worked like this:
Axe's Battle Hunger ability is based on Acid Bomb, this is the damage over time effect.

The Speed ability is based on Slow (with negative values to increase speed), the Dummy casts this on Axe.

So you only need 2 abilities, 1 being the Hero ability (Acid Bomb) and the other being the Speed buff (Slow) which the Dummy manages.
 
Level 12
Joined
May 16, 2020
Messages
660
Ahh, yes you are right, I'm actually using 2x Acid bomb, both for the Hero ability which is cast on enemies and the Dummy ability to speed boost the Hero (so I didn't copy this from your map, as I already had 2x Acid Bomb when I asked the question and it was easier to just re-map the skill-ID).

The speed boost should happen in 2 places (same as in your setup, this I didn't change):
  • Main trigger, near the bottom
  • Loop trigger

But to rephrase what I don't understand in this example:
  • When Caster A casts Battle Hunger on 2 units (Speedboost 24%), and Caster B casts it on one of these targets, the speed is supposed to be equal between Caster A (12%) and B (12%).
  • Instead, Caster A loses all speed (0%) and Caster B gets the expected speedboost of 12%.

--> If Caster B casts Battle Hunger on a unit already "belonging" to Caster A, the trigger removes the buff completely from Caster A (see main trigger, upper part). But now I would expect that the loop trigger, after 0.03 seconds, recognizes that there is 1 unit less in Caster A's group. Hence it should simply reapply the buff (but weaker this time). I don't see what the trigger is not recognizing here.... Because as stated in this scenario Caster A just loses its buff completely and it's not re-applied.

Edit: Attached the map - will delete it later since it's >50MB and I don't think Hive considered that maps would ever go above 8 MB with Reforged...
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
Ahh, yes you are right, I'm actually using 2x Acid bomb, both for the Hero ability which is cast on enemies and the Dummy ability to speed boost the Hero (so I didn't copy this from your map, as I already had 2x Acid Bomb when I asked the question and it was easier to just re-map the skill-ID).

The speed boost should happen in 2 places (same as in your setup, this I didn't change):
  • Main trigger, near the bottom
  • Loop trigger

But to rephrase what I don't understand in this example:
  • When Caster A casts Battle Hunger on 2 units (Speedboost 24%), and Caster B casts it on one of these targets, the speed is supposed to be equal between Caster A (12%) and B (12%).
  • Instead, Caster A loses all speed (0%) and Caster B gets the expected speedboost of 12%.

--> If Caster B casts Battle Hunger on a unit already "belonging" to Caster A, the trigger removes the buff completely from Caster A (see main trigger, upper part). But now I would expect that the loop trigger, after 0.03 seconds, recognizes that there is 1 unit less in Caster A's group. Hence it should simply reapply the buff (but weaker this time). I don't see what the trigger is not recognizing here.... Because as stated in this scenario Caster A just loses its buff completely and it's not re-applied.

Edit: Attached the map - will delete it later since it's >50MB and I don't think Hive considered that maps would ever go above 8 MB with Reforged...
Don't use Acid Bomb for the speed boost, use Slow.

I'll see if I can get it to work in your map.
 
Last edited:
Level 12
Joined
May 16, 2020
Messages
660
Thanks so much Uncle.

I have a few questions though after reviewing the changes:
  • Slow vs Acid Bomb: I did some further tests and I would still pick Acid Bomb over slow because (for some reason) Acid Bomb doesn't mark the hero as "red" when "debuffed" - Slow however does (see below). But maybe there a downside of using Acid Bomb instead of Slow?
  • Do you personally never replace for example (Last created unit) with a global variable? I always do this because I read it improves performance, but maybe this information is outdated?
  • Transforming this trigger to MUI was honestly quite hard (I drew like three A4 pages to understand what is going on here and help me imagine the steps). But I guess that I can apply the general thinking for spells with overwriting buffs, and for "simpler" MUI spells I can still apply your linked Dynamic Indexing guide, correct?
Edit: I had some more questions, but when writing them down they actually cleared up :)


xmuZz7U.png
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
Slow is instant which is nice. I prefer to use abilities that do NOT have missiles for applying buffs.

It actually dawned on me that you're probably better off using a hidden Endurance Aura to apply the movement speed. It would be done with a similar method (modifying the speed of the ability), and it would remove the need for Dummy units (helping with performance) and will fix any issues like the one in your picture.

And if it's true that it's more optimal to use a variable instead of Last Created Unit then feel free to do so. I don't think it'll make a noticeable difference though, unless maybe you're creating a lot of units at once.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
Here's the Endurance Aura setup I was talking about.

You'll notice when I update the speed I do some odd things. This is to "refresh" the ability, because for some reason it doesn't update the stats instantly after changing them. In this case, removing the aura buff and then disabling/enabling the ability seems to do the trick.
  • Actions
    • -------- UPDATE SPEED --------
    • Set VariableSet BattleH_Level = (Level of Battle Hunger for (Triggering unit))
    • Unit - Remove Battle Hunger (Speed) buff from (Triggering unit)
    • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Battle Hunger (Speed))'s Real Level Field: Movement Speed Increase (%) ('Oae1') of Level: 0 to (BattleH_Speed[BattleH_Level] x (Real((Number of units in BattleH_Group[BattleH_Caster_CV]))))
    • Unit - For (Triggering unit), Ability Battle Hunger (Speed), Disable ability: True, Hide UI: False
    • Unit - For (Triggering unit), Ability Battle Hunger (Speed), Disable ability: False, Hide UI: False
 

Attachments

  • Land of Legends v0.1.06 BH Fix 2.w3m
    50.9 MB · Views: 31
Level 12
Joined
May 16, 2020
Messages
660
Works perfect and is actually more close to what is in DotA 2 (there the buff is undispellable)!

I didn't see that there was a page 2 and started adding the suggested solution myself in the map. And then I was about to write that the speed doesn't update as quickly with the Aura as with the spells - so thanks also for showing me how to instantly update auras :-D

Edit: Found a bug - will update later
Edit2: Found it - a part from your previous map was missing (marked it bellow with ****) - works perfect now :)

  • Cast Battle Hunger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Battle Hunger
    • Actions
      • -------- DO THIS FIRST --------
      • Set VariableSet BattleH_Target = (Target unit of ability being cast)
      • Set VariableSet BattleH_Target_CV = (Custom value of BattleH_Target)
      • -------- --------
      • -------- ADD CASTER TO CASTER GROUP (IF NEEDED) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in BattleH_GroupCaster.) Equal to False
        • Then - Actions
          • Unit Group - Add (Triggering unit) to BattleH_GroupCaster
        • Else - Actions
      • -------- --------
      • -------- REMOVE THE TARGET FROM IT'S CURRENT BH GROUP (IF NEEDED) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BattleH_Caster[BattleH_Target_CV] Not equal to No unit
          • BattleH_Caster[BattleH_Target_CV] Not equal to (Triggering unit)
        • Then - Actions
          • Set VariableSet BattleH_TempCaster = BattleH_Caster[BattleH_Target_CV]
          • Set VariableSet BattleH_Caster_CV = (Custom value of BattleH_TempCaster)
          • Unit Group - Remove BattleH_Target from BattleH_Group[BattleH_Caster_CV].
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in BattleH_Group[BattleH_Caster_CV]) Equal to 0
            • Then - Actions
              • Unit - Remove Battle Hunger (Speed - Aura) from BattleH_TempCaster
              • Unit - Remove Battle Hunger (Speed) buff from BattleH_TempCaster
              • Unit Group - Remove BattleH_TempCaster from BattleH_GroupCaster.
              • Game - Display to (All players) the text: (Units left in Caster group: + (String((Number of units in BattleH_GroupCaster))))
              • Game - Display to (All players) the text: (Units left in Target group: + (String((Number of units in BattleH_Group[BattleH_Caster_CV]))))
              • Game - Display to (All players) the text: Destroying BattleH_...
              • Custom script: call DestroyGroup (udg_BattleH_Group[udg_BattleH_Caster_CV])
            • Else - Actions
              • Game - Display to (All players) the text: (Units left in Target group: + (String((Number of units in BattleH_Group[BattleH_Caster_CV]))))
              • -------- *****This part was missing***** --------
              • Set VariableSet BattleH_Level = (Level of Battle Hunger for BattleH_TempCaster)
              • Unit - Remove Battle Hunger (Speed) buff from BattleH_TempCaster
              • Ability - Set Ability: (Unit: BattleH_TempCaster's Ability with Ability Code: Battle Hunger (Speed - Aura))'s Real Level Field: Movement Speed Increase (%) ('Oae1') of Level: 0 to (BattleH_Speed[BattleH_Level] x (Real((Number of units in BattleH_Group[BattleH_Caster_CV]))))
              • Unit - For BattleH_TempCaster, Ability Battle Hunger (Speed - Aura), Disable ability: True, Hide UI: False
              • Unit - For BattleH_TempCaster, Ability Battle Hunger (Speed - Aura), Disable ability: False, Hide UI: False
        • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top