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

Visualize: Dynamic Indexing

Oh yeah the problem was Unit Group's size, still when the first instance's fireballs explode, second instance's fireballs stop (neither explode nor complete their way), until another instance runs, it seems it doesn't go through instance "2" .. what's the problem in here?

EDIT: Nope it runs through all instances including 2, but it seems they all go to 0 when an instance ends... :/, it's like 2nd instance was stuck, it seems FS_Index becomes 0 after the first instance ends although 2nd instance is still running :O

Did you make the changes listed in this post?
http://www.hiveworkshop.com/forums/2599477-post46.html
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
As I said, indexed are increased and decreased normally, but when an instance finishes, all instances stop; which means fireballs stop although when two instances exist, all fireballs move, which also means the trigger runs both instance and get through them...
  • Fire Spray Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fire Spraying
    • Actions
      • -------- ==== Storing ==== --------
      • Set FS_Index = (FS_Index + 1)
      • Set FS_Caster[FS_Index] = (Triggering unit)
      • Unit - Set the custom value of FS_Caster[FS_Index] to FS_Index
      • Set FS_CasterLocation = (Position of FS_Caster[FS_Index])
      • Set FS_PointTarget = (Target point of ability being cast)
      • Set FS_Level[FS_Index] = (Level of Fire Spraying for FS_Caster[FS_Index])
      • -------- ==== Configurables ==== --------
      • Set FS_Range[FS_Index] = ((75.00 x (Real(FS_Level[FS_Index]))) + 400.00)
      • Set FS_Damage[FS_Index] = ((Real(FS_Level[FS_Index])) x 100.00)
      • Set FS_Number[FS_Index] = (3 + FS_Level[FS_Index])
      • Set FS_Speed[FS_Index] = (((Real(FS_Level[FS_Index])) x 3.00) + 20.00)
      • Set FS_MinMax_Angle[FS_Index] = ((Real(FS_Level[FS_Index])) + 15.00)
      • -------- ==== Creating Dummies ==== --------
      • Set FS_DividedAngle[FS_Index] = ((FS_MinMax_Angle[FS_Index] x 2.00) / (Real(FS_Number[FS_Index])))
      • Set FS_StartingAngle[FS_Index] = ((Facing of FS_Caster[FS_Index]) - FS_MinMax_Angle[FS_Index])
      • Set FS_DistancePassed[FS_Index] = 0.00
      • For each (Integer A) from 1 to FS_Number[FS_Index], do (Actions)
        • Loop - Actions
          • Set FS_BallSpawnPoint = (FS_CasterLocation offset by 50.00 towards FS_StartingAngle[FS_Index] degrees)
          • Unit - Create 1 Fireball for (Owner of FS_Caster[FS_Index]) at FS_BallSpawnPoint facing FS_StartingAngle[FS_Index] degrees
          • Unit Group - Add (Last created unit) to FS_FireGroup[FS_Index]
          • Custom script: call RemoveLocation(udg_FS_BallSpawnPoint)
          • Set FS_StartingAngle[FS_Index] = (FS_StartingAngle[FS_Index] + FS_DividedAngle[FS_Index])
      • Set FS_DividedAngle[FS_Index] = 0.00
      • Set FS_StartingAngle[FS_Index] = 0.00
      • -------- ==== Starting Spell ==== --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FS_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Fire Spray Loop <gen>
        • Else - Actions
  • Fire Spray Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer FS_MUI) from 1 to FS_Index, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in FS_FireGroup[FS_MUI] and do (Actions)
            • Loop - Actions
              • Set FS_PickedFB = (Picked unit)
              • Set FS_CurrentPoint = (Position of FS_PickedFB)
              • Set FS_NextPoint = (FS_CurrentPoint offset by FS_Speed[FS_MUI] towards (Facing of FS_PickedFB) degrees)
              • Unit - Move FS_PickedFB instantly to FS_NextPoint
              • Custom script: call RemoveLocation(udg_FS_CurrentPoint)
              • Set FS_DistancePassed[FS_MUI] = (FS_DistancePassed[FS_MUI] + (FS_Speed[FS_MUI] / (Real(FS_Number[FS_MUI]))))
              • Set FS_EnemiesAround = (Units within 100.00 of FS_NextPoint matching (((Matching unit) belongs to an enemy of (Owner of FS_PickedFB)) Equal to True))
              • Unit Group - Pick every unit in FS_EnemiesAround and do (Actions)
                • Loop - Actions
                  • Unit - Cause FS_Caster[FS_MUI] to damage (Picked unit), dealing FS_Damage[FS_MUI] damage of attack type Spells and damage type Fire
              • Custom script: call DestroyGroup(udg_FS_EnemiesAround)
              • Custom script: call RemoveLocation(udg_FS_NextPoint)
              • Set FS_PickedFB = No unit
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FS_DistancePassed[FS_MUI] Greater than or equal to FS_Range[FS_MUI]
            • Then - Actions
              • Set FS_DistancePassed[FS_MUI] = 0.00
              • Game - Display to (All players) for 30.00 seconds the text: (String(FS_Index))
              • Unit Group - Pick every unit in FS_FireGroup[FS_MUI] and do (Actions)
                • Loop - Actions
                  • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\MarkOfChaos\MarkOfChaosTarget.mdl
                  • Unit Group - Remove (Picked unit) from FS_FireGroup[FS_MUI]
                  • Unit - Remove (Picked unit) from the game
              • Set FS_Damage[FS_MUI] = 0.00
              • Set FS_Number[FS_MUI] = 0
              • Set FS_Speed[FS_MUI] = 0.00
              • Set FS_MinMax_Angle[FS_MUI] = 0.00
              • Set FS_Caster[FS_MUI] = No unit
              • Set FS_Index = (FS_Index - 1)
              • Set FS_MUI = (FS_MUI - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FS_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
For some reason you're simply nulling all data that belongs to the used up cast and then decrement the counter by 1, meaning that instead of 1 deindex you actually do 2 and leave a gap within the data.
Instead of nulling the data you should assign the data of the last instance to the one you're terminating. That way you replace the current with the last and don't leave a gap. Then decrement the counter like you have done.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
I wonder why it still doesn't work... damn!


  • Fire Spray Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fire Spraying
    • Actions
      • -------- ==== Storing ==== --------
      • Set FS_Index = (FS_Index + 1)
      • Set FS_Caster[FS_Index] = (Triggering unit)
      • Unit - Set the custom value of FS_Caster[FS_Index] to FS_Index
      • Set FS_CasterLocation = (Position of FS_Caster[FS_Index])
      • Set FS_PointTarget = (Target point of ability being cast)
      • Set FS_Level[FS_Index] = (Level of Fire Spraying for FS_Caster[FS_Index])
      • -------- ==== Configurables ==== --------
      • Set FS_Range[FS_Index] = ((75.00 x (Real(FS_Level[FS_Index]))) + 400.00)
      • Set FS_Damage[FS_Index] = ((Real(FS_Level[FS_Index])) x 100.00)
      • Set FS_Number[FS_Index] = (3 + FS_Level[FS_Index])
      • Set FS_Speed[FS_Index] = (((Real(FS_Level[FS_Index])) x 3.00) + 20.00)
      • Set FS_MinMax_Angle[FS_Index] = ((Real(FS_Level[FS_Index])) + 15.00)
      • -------- ==== Creating Dummies ==== --------
      • Set FS_DividedAngle[FS_Index] = ((FS_MinMax_Angle[FS_Index] x 2.00) / (Real(FS_Number[FS_Index])))
      • Set FS_StartingAngle[FS_Index] = ((Facing of FS_Caster[FS_Index]) - FS_MinMax_Angle[FS_Index])
      • Set FS_DistancePassed[FS_Index] = 0.00
      • For each (Integer A) from 1 to FS_Number[FS_Index], do (Actions)
        • Loop - Actions
          • Set FS_BallSpawnPoint = (FS_CasterLocation offset by 50.00 towards FS_StartingAngle[FS_Index] degrees)
          • Unit - Create 1 Fireball for (Owner of FS_Caster[FS_Index]) at FS_BallSpawnPoint facing FS_StartingAngle[FS_Index] degrees
          • Unit Group - Add (Last created unit) to FS_FireGroup[FS_Index]
          • Custom script: call RemoveLocation(udg_FS_BallSpawnPoint)
          • Set FS_StartingAngle[FS_Index] = (FS_StartingAngle[FS_Index] + FS_DividedAngle[FS_Index])
      • Set FS_DividedAngle[FS_Index] = 0.00
      • Set FS_StartingAngle[FS_Index] = 0.00
      • -------- ==== Starting Spell ==== --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FS_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Fire Spray Loop <gen>
        • Else - Actions
  • Fire Spray Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer FS_MUI) from 1 to FS_Index, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in FS_FireGroup[FS_MUI] and do (Actions)
            • Loop - Actions
              • Set FS_PickedFB = (Picked unit)
              • Set FS_CurrentPoint = (Position of FS_PickedFB)
              • Set FS_NextPoint = (FS_CurrentPoint offset by FS_Speed[FS_MUI] towards (Facing of FS_PickedFB) degrees)
              • Unit - Move FS_PickedFB instantly to FS_NextPoint
              • Custom script: call RemoveLocation(udg_FS_CurrentPoint)
              • Set FS_DistancePassed[FS_MUI] = (FS_DistancePassed[FS_MUI] + (FS_Speed[FS_MUI] / (Real(FS_Number[FS_MUI]))))
              • Set FS_EnemiesAround = (Units within 100.00 of FS_NextPoint matching (((Matching unit) belongs to an enemy of (Owner of FS_PickedFB)) Equal to True))
              • Unit Group - Pick every unit in FS_EnemiesAround and do (Actions)
                • Loop - Actions
                  • Unit - Cause FS_Caster[FS_MUI] to damage (Picked unit), dealing FS_Damage[FS_MUI] damage of attack type Spells and damage type Fire
              • Custom script: call DestroyGroup(udg_FS_EnemiesAround)
              • Custom script: call RemoveLocation(udg_FS_NextPoint)
              • Set FS_PickedFB = No unit
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FS_DistancePassed[FS_MUI] Greater than or equal to FS_Range[FS_MUI]
            • Then - Actions
              • Unit Group - Pick every unit in FS_FireGroup[FS_MUI] and do (Actions)
                • Loop - Actions
                  • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\MarkOfChaos\MarkOfChaosTarget.mdl
                  • Unit Group - Remove (Picked unit) from FS_FireGroup[FS_MUI]
                  • Unit - Remove (Picked unit) from the game
              • Set FS_DistancePassed[FS_MUI] = FS_DistancePassed[FS_Index]
              • Set FS_Damage[FS_MUI] = FS_Damage[FS_Index]
              • Set FS_Number[FS_MUI] = FS_Number[FS_Index]
              • Set FS_Speed[FS_MUI] = FS_Speed[FS_Index]
              • Set FS_MinMax_Angle[FS_MUI] = FS_MinMax_Angle[FS_Index]
              • Set FS_Caster[FS_MUI] = FS_Caster[FS_Index]
              • Set FS_Index = (FS_Index - 1)
              • Set FS_MUI = (FS_MUI - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FS_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
 
I assume you would use a hashtable with the unit-group method.

If you just need to store the caster (i.e. you're using the unit-group only), then it might depend. I still think arrays will still be faster since groups defer their callback to a separate thread.

But I just wrote those notes since people have asked for it in the past. They should be taken with a grain of salt since the performance difference is negligible.
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
I assume you would use a hashtable with the unit-group method.

If you just need to store the caster (i.e. you're using the unit-group only), then it might depend. I still think arrays will still be faster since groups defer their callback to a separate thread.

But I just wrote those notes since people have asked for it in the past. They should be taken with a grain of salt since the performance difference is negligible.

Ok then. :thumbs_up:
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
Hashtables are more convenient to use (= require less lines). That is probably the biggest pro for GUIers.
The downside is that you need to assign unique child indices for each spell if you use only one global hashtable, so your triggers become a bit less readable.

Anyway, great tutorial! I totally missed that one. Nice visuals!
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
@Antimatter
- Yes, it will still work because there will always be a very tiny difference i time (not exactly at the same time) thus there is an order/flow of what to do
- If your spell will not have an effect over time, then yes you can used any temp variable and you no longer need to deindex
 
Shadow Flux is correct.

If a spell is MUI, it should be able to handle any number of units casting the spell at the same "time". (I put "time" in quotes because it doesn't necessarily have to be at the same instant, they just have to be going on at the same time)

If the spell is instant (no waits, no timers), then MUI is not a concern. As Shadow Flux pointed out, wc3 runs things one at a time. So you should be safe to use regular variables without any indexing.
 
Level 4
Joined
Nov 4, 2016
Messages
34
@PurgeandFire I have some questions, if answered, that may solve my problem in my map :(

-------------------------------------------------------------------
Ability Name:
SOUL STEAL
Ability Description:
Saps the life force of the target enemy, draining 5 health
every second. Lasts 10 seconds.
-------------------------------------------------------------------

Using MUI, Soul Steal can be used by with no problem as tested.
many units
But what if a unit will cast Soul Steal in the same unit many times?

Example:
(Unit A) casted Soul Steal on (Unit B)
(Unit A) casted Soul Steal again on (Unit B)

This means, Soul Steal will stack on the same unit.

How can I allow Soul Steal to only refresh the duration when casted on the same unit without stacking it?

Example:
(Unit A) casted Soul Steal on (Unit B)
(Unit A) casted Soul Steal again on (Unit B)

This means, Soul Steal will stack on the same unit.

How can I allow Soul Steal to only refresh the duration when casted on the same unit without stacking it?
 
Last edited by a moderator:
@Atirak Good question. When the user casts the ability, we can check if he is already casting the spell on the same unit. If so, just set the counter back to 0. That should "refresh" the spell's duration. Here is an example with the spell in the tutorial:
  • Siphon Life Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Siphon Life
    • Actions
      • -------- Loop through each active spell cast --------
      • For each (SL_Loop_Integer) from 1 to SL_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else actions)
            • If - Conditions
              • -------- Check if the caster and target are the same as this spell cast --------
              • (SL_Caster[SL_Loop_Integer]) Equal to (Triggering unit)
              • (SL_Target[SL_Loop_Integer]) Equal to (Target unit of ability being cast)
            • Then - Actions
              • -------- Set the counter to 0 so the spell will start over --------
              • Set SL_Counter[SL_Loop_Integer] = 0
              • -------- Skip the rest of the code because we don't want it to stack --------
              • Skip Remaining Actions
            • Else - Actions
      • Set SL_Index = SL_Index + 1
      • Set SL_Caster[SL_Index] = (Triggering unit)
      • Set SL_Target[SL_Index] = (Target unit of ability being cast)
      • Set SL_Counter[SL_Index] = 0
      • If (All Conditions are True) then do (Then Actions) else do (Else actions)
        • If - Conditions
          • SL_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Siphon Life Loop <gen>
        • Else - Actions
If you're still running into problems, post the triggers here and I'll try to help to the best of my ability. :)
 
@MasterTrainer Haha, honestly, I think people originally called it static indexing, then someone decided it would be more appropriate to call it "dynamic indexing". And then there were a bunch of people who just called it "indexing".

Arguments could be made for both. With static indexing, someone could say "the spell instances are assigned one index for their entire lifetime, so it should be named static indexing". For dynamic indexing, someone could say "the array of spell instances is being manipulated constantly, and indexes are recycled, so it should be named dynamic indexing". Feel free to call it whatever you'd like. ¯\_(ツ)_/¯
 
Level 8
Joined
Jan 8, 2013
Messages
348
i have a question, what if i have to use 2 loops? or more triggers like..

i use the spell and gets a buff. then theres the loop checking when the buff runs out.
the buff also makes me deal extra damage and i need a trigger when a unit gets damage to let my hero deal more damage. etc. what if i have a spell for what i need more then 2 triggers. lets say 5?
 
Level 8
Joined
Jan 8, 2013
Messages
348
just wantet to recreate this problem. but for some reasons it worked for me now.. maybe i did something wrong the years before. well nevermind :D
 
Level 8
Joined
Jan 8, 2013
Messages
348
Well now i got into the bug i had a few years ago! IM creating balls behind a back of the unit(max. 8 balls) each few seconds. its one inititaltrigger which setts up the unit and integers and 1 loop. everything works fine in MUI.

Now everytime im using a spell 4 balls should be used. so he have 4 balls. but that bugs in MUI. 4 balls for everyone is beeing used. and that was my problem.

here i create the balls! If a unit enters the game i set him in the "BallSystem"

b709d2e691d4e06055c51c5614d99492.png


Heres the loop.
the if then else in the else-Action section doesnt matter to show. its just checking how much the integer is and creates balls on the back.
And i dont reduce the index at the end becasue this System is permanent
019582f020569a0539b123b359102b37.png


Now i use this in another spell.
Im using a new Index becasue its a new spelll. but using the Indexing from the first ballsystem to reduce the amount of balls by 4.. But how does the game know which unit is using the spell and by which unit he should remove the 4 balls? in the code i have he reduces the balls of every unit.
0b284d04e6a56159f1c51a9466080d41.png

And thats the closed indexing.
8f5601a23dc919b6074133f4b4b95a67.png
 

deepstrasz

Map Reviewer
Level 68
Joined
Jun 4, 2009
Messages
18,706
How do I remove a location that's using an array? I can't save the map and the code checker also gives an error for some reason. Tried both writing the variable name with and without the index name between square brackets.
 

deepstrasz

Map Reviewer
Level 68
Joined
Jun 4, 2009
Messages
18,706
Do you write udg_ for both index variable and location variable?
No, only one udg like this: call RemoveLocation (udg_ShieldsTrainedUnitPoint[FloatingTextsLoopInteger])

It doesn't work like this: call RemoveLocation (udg_ShieldsTrainedUnitPoint_udg_[FloatingTextsLoopInteger]) in case that's what you meant.

call RemoveLocation (udg_ShieldsTrainedUnitPoint) by itself doesn't work either.

EDIT: found something similar on another thread by accident. This is how I should have written it:
call RemoveLocation (udg_ShieldsTrainedUnitPoint[udg_FloatingTextsLoopInteger])
 
Last edited:

deepstrasz

Map Reviewer
Level 68
Joined
Jun 4, 2009
Messages
18,706
I'm trying to figure out how would the last part

  • base.gif
    Siphon Life Loop
    • joinminus.gif
      events.gif
      Events
      • line.gif
        joinbottom.gif
        timer.gif
        Time - Every 0.10 seconds of game time
    • join.gif
      cond.gif
      Conditions
    • joinbottomminus.gif
      actions.gif
      Actions
      • empty.gif
        joinbottomminus.gif
        if.gif
        For each (SL_Loop_Integer) from 1 to SL_Index, do (Actions)
        • empty.gif
          empty.gif
          joinbottomminus.gif
          actions.gif
          Loop - Actions
          • empty.gif
            empty.gif
            empty.gif
            join.gif
            unit.gif
            Unit - Cause SL_Caster[SL_Loop_Integer] to damage SL_Target[SL_Loop_Integer], dealing 2 damage of attack type Spells and damage type Normal
          • empty.gif
            empty.gif
            empty.gif
            join.gif
            unit.gif
            Unit - Set life of SL_Caster[SL_Loop_Integer] to ((Life of SL_Caster[SL_Loop_Integer]) + 2.00)
          • empty.gif
            empty.gif
            empty.gif
            join.gif
            set.gif
            Set SL_Counter[SL_Loop_Integer] = (SL_Counter[SL_Loop_Integer] + 0.10)
          • empty.gif
            empty.gif
            empty.gif
            joinbottomminus.gif
            if.gif
            If (All Conditions are True) then do (Then Actions) else do (Else actions)
            • empty.gif
              empty.gif
              empty.gif
              empty.gif
              joinminus.gif
              cond.gif
              If - Conditions
              • empty.gif
                empty.gif
                empty.gif
                empty.gif
                line.gif
                joinbottom.gif
                if.gif
                SL_Counter[SL_Loop_Integer] Greater than or equal to 3.00
            • empty.gif
              empty.gif
              empty.gif
              empty.gif
              joinminus.gif
              actions.gif
              Then - Actions
              • empty.gif
                empty.gif
                empty.gif
                empty.gif
                line.gif
                join.gif
                set.gif
                Set SL_Caster[SL_Loop_Integer] = SL_Caster[SL_Index]
              • empty.gif
                empty.gif
                empty.gif
                empty.gif
                line.gif
                join.gif
                set.gif
                Set SL_Target[SL_Loop_Integer] = SL_Target[SL_Index]
              • empty.gif
                empty.gif
                empty.gif
                empty.gif
                line.gif
                join.gif
                set.gif
                Set SL_Counter[SL_Loop_Integer] = SL_Counter[SL_Index]
              • empty.gif
                empty.gif
                empty.gif
                empty.gif
                line.gif
                join.gif
                set.gif
                Set SL_Index = (SL_Index - 1)
              • empty.gif
                empty.gif
                empty.gif
                empty.gif
                line.gif
                join.gif
                set.gif
                Set SL_Loop_Integer = (SL_Loop_Integer - 1)
              • empty.gif
                empty.gif
                empty.gif
                empty.gif
                line.gif
                joinbottomminus.gif
                if.gif
                If (All Conditions are True) then do (Then Actions) else do (Else actions)
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  empty.gif
                  joinminus.gif
                  cond.gif
                  If - Conditions
                  • empty.gif
                    empty.gif
                    empty.gif
                    empty.gif
                    line.gif
                    empty.gif
                    line.gif
                    joinbottom.gif
                    if.gif
                    SL_Index Equal to 0
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  empty.gif
                  joinminus.gif
                  actions.gif
                  Then - Actions
                  • empty.gif
                    empty.gif
                    empty.gif
                    empty.gif
                    line.gif
                    empty.gif
                    line.gif
                    joinbottom.gif
                    page.gif
                    Trigger - Turn off (This trigger)
                • empty.gif
                  empty.gif
                  empty.gif
                  empty.gif
                  line.gif
                  empty.gif
                  joinbottom.gif
                  actions.gif
                  Else - Actions
            • empty.gif
              empty.gif
              empty.gif
              empty.gif
              joinbottom.gif
              actions.gif
              Else - Actions

work with the fourth/last hero or any dying in the process of life-mana stealing. How would I know which hero and how to exclude them from being overwritten/switched?

EDIT:
I think I solved it:

  • Shield Texts OFF
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer FloatingTextsOFFLoopInteger) from 1 to ShieldsIndexInteger, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Dying unit) Equal to ShieldsTrainedUnit[FloatingTextsOFFLoopInteger]
                  • ((Dying unit) is in ShieldUnitsGroup) Equal to True
            • Then - Actions
              • Unit - Set Name of ShieldsTrainedUnit[FloatingTextsOFFLoopInteger] to UnitNameString[FloatingTextsOFFLoopInteger]
              • Unit Group - Remove ShieldsTrainedUnit[FloatingTextsOFFLoopInteger] from ShieldUnitsGroup
              • Game - Display to (All players) the text: (UnitsInGroup + (String((Number of units in ShieldUnitsGroup))))
              • Unit - Add a 60.00 second Generic expiration timer to ShieldsTrainedUnit[FloatingTextsOFFLoopInteger]
              • Set ShieldsTrainedUnit[FloatingTextsOFFLoopInteger] = ShieldsTrainedUnit[ShieldsIndexInteger]
              • Set ShieldsIndexInteger = (ShieldsIndexInteger - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • (Number of units in ShieldUnitsGroup) Equal to 0
                • Then - Actions
                  • Cinematic - Clear the screen of text messages for (All players)
                  • Set ShieldsIndexInteger = 0
                  • Set ShieldsArmourValue[FloatingTextsOFFLoopInteger] = 0
                  • Set ShieldsMaxValue[FloatingTextsOFFLoopInteger] = 0
                  • Game - Display to (All players) the text: (Index + (String(ShieldsIndexInteger)))
                  • Game - Display to (All players) the text: (UnitsInGroup + (String((Number of units in ShieldUnitsGroup))))
                  • Game - Display to (All players) the text: (ArmourValue + (String(ShieldsArmourValue[FloatingTextsOFFLoopInteger])))
                  • Game - Display to (All players) the text: (ArmourUpgrade + (String(ShieldsArmourUpgradeInteger)))
                  • Trigger - Turn off Shield Texts OFF <gen>
                  • Trigger - Turn off Shield Floating Texts Move <gen>
                  • Trigger - Turn off Shields Regenerate <gen>
                  • Trigger - Turn off Shield Units Damaged <gen>
                  • Trigger - Turn off Shield Boni Abilities <gen>
                  • Unit Group - Remove all units from ShieldUnitsGroup
                  • Custom script: call DestroyGroup (udg_ShieldUnitsGroup)
                • Else - Actions
 
Last edited:

deepstrasz

Map Reviewer
Level 68
Joined
Jun 4, 2009
Messages
18,706
Hey, do array integers with an array within work?

  • Carrier Train Index
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Whelp Carrying Red Dragon
        • Then - Actions
          • Set CarrierIndexInteger = (CarrierIndexInteger + 1)
          • Set CarrierTrained[CarrierIndexInteger] = (Entering unit)
          • Unit Group - Add CarrierTrained[CarrierIndexInteger] to CarrierGroup
          • -------- Check If Ready to Go --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CarrierIndexInteger Greater than 0
            • Then - Actions
            • Else - Actions
        • Else - Actions


  • Interceptor Train MUI
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • For each (Integer CarrierCastInteger) from 1 to CarrierIndexInteger, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Ability being cast) Equal to Train Intercepting Red Dragon Whelp (Berserk)
                  • CarrierInterceptorIndexInteger[CarrierCastInteger] Less than 8
                  • (Casting unit) Equal to CarrierTrained[CarrierCastInteger]
            • Then - Actions
              • Game - Display to (All players) the text: Carrier Casts
              • Set CarrierInterceptorIndexInteger[CarrierCastInteger] = (CarrierInterceptorIndexInteger[CarrierCastInteger] + 1)
              • Set InterceptorCreatePoint[CarrierCastInteger] = (Position of CarrierTrained[CarrierCastInteger])
              • Unit - Create 1 Intercepting Red Dragon Whelp for Player 1 (Red) at InterceptorCreatePoint[CarrierCastInteger] facing (Facing of CarrierTrained[CarrierCastInteger]) degrees
              • Set CarrierInterceptorUnit[CarrierInterceptorIndexInteger[CarrierCastInteger]] = (Last created unit)
              • Game - Display to (All players) the text: (Name of CarrierInterceptorUnit[CarrierCastInteger])
              • Unit Group - Add CarrierInterceptorUnit[CarrierInterceptorIndexInteger[CarrierCastInteger]] to InterceptorArrayGroup[CarrierInterceptorIndexInteger[CarrierCastInteger]]
              • Game - Display to (All players) the text: (InterceptorIndexInteger + (String(CarrierInterceptorIndexInteger[CarrierCastInteger])))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CarrierInterceptorIndexInteger[CarrierCastInteger] Equal to 8
                • Then - Actions
                  • Unit - For CarrierTrained[CarrierCastInteger], Ability Train Intercepting Red Dragon Whelp (Berserk), Hide ability: True
                • Else - Actions
            • Else - Actions


  • Interceptor Clear MUI
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer InterceptorDieInteger) from 1 to CarrierInterceptorIndexInteger[CarrierCastInteger], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Dying unit) Equal to CarrierInterceptorUnit[CarrierInterceptorIndexInteger[InterceptorDieInteger]]
            • Then - Actions
              • Game - Display to (All players) the text: Interceptor Died
              • Unit Group - Remove CarrierInterceptorUnit[CarrierInterceptorIndexInteger[InterceptorDieInteger]] from InterceptorArrayGroup[InterceptorDieInteger]
            • Else - Actions
          • -------- Unhide Interceptor Train Ability --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CarrierInterceptorIndexInteger[InterceptorDieInteger] Less than 8
            • Then - Actions
              • Unit - For CarrierTrained[InterceptorDieInteger], Ability Train Intercepting Red Dragon Whelp (Berserk), Hide ability: False
            • Else - Actions

I'm trying to MUI those triggers this way and the last trigger's loop doesn't start the actions with the CarrierCastInteger:
  • For each (Integer InterceptorDieInteger) from 1 to CarrierInterceptorIndexInteger[CarrierCastInteger], do (Actions)
but does start them with CarrierIndexInteger but not properly:
  • For each (Integer InterceptorDieInteger) from 1 to CarrierInterceptorIndexInteger[CarrierIndexInteger], do (Actions)
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,864
Yes they do work, but they have no use here and makes no sense. Your variable names cause so much confusion...
Rename CarrierIndexInteger to CarrierMaxCount, CarrierCastInteger to CarrierLoop, InterceptorCreatePoint to InterceptorLoc and InterceptorArrayGroup to InterceptorGroup. You make godly looooooong variable names, makes it really hard to read.
Why is
  • (Ability being cast) Equal to Train Intercepting Red Dragon Whelp (Berserk)
inside the loop?That's pointless. Move that to the first icon of conditions. Remove
  • And - All (Conditions) are true
it isn't doing anything here, multiple conditions aggregated together are assumed as if all conditions are true/false.
  • Unit Group - Add CarrierInterceptorUnit[CarrierInterceptorIndexInteger[CarrierCastInteger]] to InterceptorArrayGroup[CarrierInterceptorIndexInteger[CarrierCastInteger]]
is wrong, it should be
  • Unit Group - Add CarrierInterceptorUnit[CarrierCastInteger] to InterceptorArrayGroup[[CarrierCastInteger]
CarrierInterceptorUnit will get overwritten, think about it:
On the first Loop you have this: CarrierCastInteger = 1
  • CarrierInterceptorIndexInteger[1] = CarrierInterceptorIndexInteger[1] + 1 = 1
  • InterceptorCreatePoint[1] = position of blablabla...
  • Set CarrierInterceptorUnit[1] = (Last created unit)
  • Unit Group - Add CarrierInterceptorUnit[1] to InterceptorArrayGroup[1]
Next iteration: CarrierCastInteger = CarrierCastInteger + 1 = 2
  • set CarrierInterceptorIndexInteger[2] = (CarrierInterceptorIndexInteger[2] + 1) //THIS HAVE VALUE OF 1 AND WILL FUCK THE REST OF THE TRIGGER
  • Set InterceptorCreatePoint[2] = position of blablabla...
  • Set CarrierInterceptorUnit[1] = (Last created unit) // ALREADY WRONG HERE
  • Unit Group - Add CarrierInterceptorUnit[1] to InterceptorArrayGroup[1] // WRONG
Now my question is... did you initialize the groups? InterceptorArrayGroup[some high value]? Otherwise, in a map initialization trigger do it:
  • Custom Script: call set udg_InterceptorArrayGroup[loop] = CreateGroup()
Because you can't add units to a group that doesn't even exist.
Where is the deindex part of this system?
This is my quick check run of these triggers, tell me if I'm missing something.
 

deepstrasz

Map Reviewer
Level 68
Joined
Jun 4, 2009
Messages
18,706
You make godly looooooong variable names, makes it really hard to read.
Some of them are long because I started GUI first and then transposed to MUI, hence copying and renaming the previous variables :D
is wrong, it should be
Well, I thought doing it that way might mean storing the interceptors for that specific carrier.
Does the way you wrote it assign the interceptor to the casting carrier? Because afterwards I have periodic event triggers moving the interceptors near the carriers and each set of 8 interceptors has to move to the carrier that made them.
CarrierInterceptorUnit will get overwritten, think about it:
I had no idea how it worked. I thought it was still +1 to the integer. I didn't now arrays overwrite nearby ones.
Because you can't add units to a group that doesn't even exist.
Apparently you can :p It works wonders with the shield system I made before: Protoss Carrier+Interceptor System (GUI) - need help!
Where is the deindex part of this system?
It's currently disabled because the loop didn't want to work (the debug message did not appear) as mentioned in my previous post.

EDIT:
forgot to attach the map.
 

Attachments

  • ProtossShieldsTestX.w3x
    85.4 KB · Views: 49
Last edited:

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,864
It's currently disabled because the loop didn't want to work (the debug message did not appear) as mentioned in my previous post.
Because
is wrong, it should be

Well, I thought doing it that way might mean storing the interceptors for that specific carrier.
Does the way you wrote it assign the interceptor to the casting carrier? Because afterwards I have periodic event triggers moving the interceptors near the carriers and each set of 8 interceptors has to move to the carrier that made them.
Yes, you simply have the IntercerptorGroup[index] which the index points to the carrier index. It's way easier than you think. Like i said, arrays inside arrays here have no use and don't make sense. Don't use them in indexing methods like this one. In fact, you don't need CarrierInterceptorUnit.

I had no idea how it worked. I thought it was still +1 to the integer. I didn't now arrays overwrite nearby ones.
The way you used it yes. Look closer:
set maxindex = maxindex + 1 = 1 array value
set index2[maxindex] = index2[maxindex] + 1 = 1 array value
set unit[maxindex] = some unit = 1 array value
set aggregatedunit[index2[maxindex] = some other unit = 1 array value
set maxindex = maxindex + 1 = 2 array value
set index2[maxindex] = index2[maxindex] + 1 = 1 array value
set unit[maxindex] = some unit = 2 array value
set aggregatedunit[index2[maxindex] = some other unit = 1 array value
See? allocation is wrong

Apparently you can :p It works wonders with the shield system I made before: Protoss Carrier+Interceptor System (GUI) - need help!
You're still not showing me the whole scenario here :'(
Edit: :O you attached map
 

deepstrasz

Map Reviewer
Level 68
Joined
Jun 4, 2009
Messages
18,706
Last edited:
Top