• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Dynamic Indexing Usage

Status
Not open for further replies.
Level 5
Joined
Jun 28, 2010
Messages
110
I've released my very first spell recently, but indeed i did use custom value (which is not allowed in hive), BP ask me to do "Indexing" instead of "Custom Value" for public releasing spell.
My Custom Value ones is fine, but my Indexing currently not working (i'm not even surprised because i don't totally understand this so i might need more explaination from you guys, thanks in advance)

Here is my code (written in Custom Value)

  • Arctic Blast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arctic Blast
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ArcticBlastCustomValue Less than 100
        • Then - Actions
          • Set ArcticBlastCustomValue = (ArcticBlastCustomValue + 1)
        • Else - Actions
          • Set ArcticBlastCustomValue = 1
      • Set ArcticBlastCaster[ArcticBlastCustomValue] = (Triggering unit)
      • Set ArcticBlastLevel = (Level of Arctic Blast for ArcticBlastCaster[ArcticBlastCustomValue])
      • Set ArcticBlastDamage[ArcticBlastCustomValue] = (100.00 x (Real(ArcticBlastLevel)))
      • Set ArcticBlastBoolean[ArcticBlastCustomValue] = True
      • Set ArcticBlastDistance[ArcticBlastCustomValue] = 0.00
      • Set ArcticBlastSpeed[ArcticBlastCustomValue] = 400.00
      • Set ArcticBlastMaxDistance[ArcticBlastCustomValue] = (500.00 + (100.00 x (Real(ArcticBlastLevel))))
      • Set ArcticBlastPoint = (Position of (Triggering unit))
      • Set ArcticBlastReal = 0.00
      • Set ArcticBlastEffectAmount = 36
      • For each (Integer A) from 1 to ArcticBlastEffectAmount, do (Actions)
        • Loop - Actions
          • Set ArcticBlastReal = (ArcticBlastReal + (360.00 / (Real(ArcticBlastEffectAmount))))
          • Set ArcticBlastOffset = (ArcticBlastPoint offset by ArcticBlastDistance[ArcticBlastCustomValue] towards ArcticBlastReal degrees)
          • Unit - Create 1 ArcticBlastVisualDummy for (Owner of (Triggering unit)) at ArcticBlastOffset facing ArcticBlastReal degrees
          • Unit - Set the custom value of (Last created unit) to (Integer(ArcticBlastReal))
          • Unit Group - Add (Last created unit) to ArcticBlastUnitGroup[ArcticBlastCustomValue]
          • Custom script: call RemoveLocation(udg_ArcticBlastOffset)
      • Unit - Create 1 ArcticBlastDummy for (Owner of ArcticBlastCaster[ArcticBlastCustomValue]) at ArcticBlastPoint facing Default building facing degrees
      • Unit - Set the custom value of (Last created unit) to ArcticBlastCustomValue
      • Unit Group - Add (Last created unit) to ArcticBlastDummyGroup
      • Custom script: call RemoveLocation(udg_ArcticBlastPoint)
  • Arctic Blast Expand
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ArcticBlastDummyGroup and do (Actions)
        • Loop - Actions
          • Set ArcticBlastExpandValue = (Custom value of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ArcticBlastBoolean[ArcticBlastExpandValue] Equal to False
            • Then - Actions
              • Unit Group - Remove all units from ArcticBlastDamagedGroup[ArcticBlastExpandValue]
              • Unit Group - Pick every unit in ArcticBlastUnitGroup[ArcticBlastExpandValue] and do (Actions)
                • Loop - Actions
                  • Unit - Kill (Picked unit)
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ArcticBlastDistance[ArcticBlastExpandValue] Greater than or equal to ArcticBlastMaxDistance[ArcticBlastExpandValue]
                • Then - Actions
                  • Unit Group - Remove all units from ArcticBlastDamagedGroup[ArcticBlastExpandValue]
                  • Set ArcticBlastBoolean[ArcticBlastExpandValue] = False
                • Else - Actions
                  • Set ArcticBlastDistance[ArcticBlastExpandValue] = (ArcticBlastDistance[ArcticBlastExpandValue] + (ArcticBlastSpeed[ArcticBlastExpandValue] / 50.00))
                  • Set ArcticBlastPoint = (Position of ArcticBlastCaster[ArcticBlastExpandValue])
                  • Unit Group - Pick every unit in ArcticBlastUnitGroup[ArcticBlastExpandValue] and do (Actions)
                    • Loop - Actions
                      • Set ArcticBlastReal = (Real((Custom value of (Picked unit))))
                      • Set ArcticBlastOffset = (ArcticBlastPoint offset by ArcticBlastDistance[ArcticBlastExpandValue] towards ArcticBlastReal degrees)
                      • Unit - Move (Picked unit) instantly to ArcticBlastOffset, facing ArcticBlastReal degrees
                      • Set ArcticBlastGroup = (Units within 200.00 of ArcticBlastOffset matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner
                      • Unit Group - Pick every unit in ArcticBlastGroup and do (Actions)
                        • Loop - Actions
                          • Set ArcticBlastPickedPoint = (Position of (Picked unit))
                          • Unit - Cause ArcticBlastCaster[ArcticBlastExpandValue] to damage (Picked unit), dealing ArcticBlastDamage[ArcticBlastExpandValue] damage of attack type Spells and damage type Universal
                          • Unit - Create 1 ArcticBlastDummy for (Owner of ArcticBlastCaster[ArcticBlastExpandValue]) at ArcticBlastPickedPoint facing ArcticBlastPickedPoint
                          • Unit - Add ArcticBlastSlow to (Last created unit)
                          • Unit - Set level of ArcticBlastSlow for (Last created unit) to (Level of ArcticBlast for ArcticBlastCaster[ArcticBlastExpandValue])
                          • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                          • Special Effect - Create a special effect attached to the origin of (Picked unit) using ArcticBlastDamageEffect
                          • Special Effect - Destroy (Last created special effect)
                          • Unit Group - Add (Picked unit) to ArcticBlastDamagedGroup[ArcticBlastExpandValue]
                          • Custom script: call RemoveLocation(udg_ArcticBlastPickedPoint)
                      • Custom script: call DestroyGroup(udg_ArcticBlastGroup)
                      • Custom script: call RemoveLocation(udg_ArcticBlastOffset)
                  • Custom script: call RemoveLocation(udg_ArcticBlastPoint)
Here is my code in Indexing which is "raw" because i havent finished it yet.
  • Arctic Blast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arctic Blast
    • Actions
      • For each (Integer A) from 1 to ArcticBlastEffectAmount, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ArcticBlastIndex Equal to 0
            • Then - Actions
              • Trigger - Turn on Arctic Blast Expand <gen>
            • Else - Actions
          • Set ArcticBlastIndex = (ArcticBlastIndex + 1)
          • Custom script: set udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] = CreateGroup()
          • Set ArcticBlastCaster[ArcticBlastIndex] = (Triggering unit)
          • Set ArcticBlastLevel[ArcticBlastIndex] = (Level of Arctic Blast for ArcticBlastCaster[ArcticBlastIndex])
          • Set ArcticBlastBoolean[ArcticBlastIndex] = True
          • Set ArcticBlastDistance[ArcticBlastIndex] = 0.00
          • Set ArcticBlastPoint = (Position of (Triggering unit))
          • Set ArcticBlastReal = 0.00
          • Set ArcticBlastReal = (ArcticBlastReal + (360.00 / (Real(ArcticBlastEffectAmount))))
          • Set ArcticBlastOffset = (ArcticBlastPoint offset by ArcticBlastDistance[ArcticBlastIndex] towards ArcticBlastReal degrees)
          • Unit - Create 1 ArcticBlastVisualDummy for (Owner of (Triggering unit)) at ArcticBlastOffset facing ArcticBlastReal degrees
          • Set ArcticBlastVisualDummyUnit[ArcticBlastIndex] = (Last created unit)
          • Custom script: call RemoveLocation(udg_ArcticBlastOffset)
      • Unit - Create 1 ArcticBlastDummy for (Owner of ArcticBlastCaster[ArcticBlastIndex]) at ArcticBlastPoint facing Default building facing degrees
      • Set ArcticBlastDummyUnit[ArcticBlastIndex] = (Last created unit)
      • Custom script: call RemoveLocation(udg_ArcticBlastPoint)
  • Arctic Blast Expand
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ArcticBlastLoopIndex) from 1 to ArcticBlastIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ArcticBlastDistance[ArcticBlastLoopIndex] Greater than or equal to ArcticBlastMaxDistance[ArcticBlastLevel[ArcticBlastLoopIndex]]
            • Then - Actions
              • Unit Group - Remove all units from ArcticBlastDamagedGroup[ArcticBlastLoopIndex]
              • Unit - Kill ArcticBlastVisualDummyUnit[ArcticBlastLoopIndex]
              • Unit - Remove ArcticBlastDummyUnit[ArcticBlastLoopIndex] from the game
              • Set ArcticBlastLevel[ArcticBlastLoopIndex] = ArcticBlastLevel[ArcticBlastIndex]
              • Set ArcticBlastDistance[ArcticBlastLoopIndex] = ArcticBlastMaxDistance[ArcticBlastIndex]
              • Set ArcticBlastCaster[ArcticBlastLoopIndex] = ArcticBlastCaster[ArcticBlastIndex]
              • Set ArcticBlastDummyUnit[ArcticBlastLoopIndex] = ArcticBlastDummyUnit[ArcticBlastIndex]
              • Set ArcticBlastVisualDummyUnit[ArcticBlastLoopIndex] = ArcticBlastVisualDummyUnit[ArcticBlastIndex]
              • Set ArcticBlastBoolean[ArcticBlastLoopIndex] = ArcticBlastBoolean[ArcticBlastIndex]
              • Set ArcticBlastDamagedGroup[ArcticBlastLoopIndex] = ArcticBlastDamagedGroup[ArcticBlastIndex]
              • Set ArcticBlastIndex = (ArcticBlastIndex - 1)
              • Set ArcticBlastLoopIndex = (ArcticBlastLoopIndex - 1)
            • Else - Actions
              • Set ArcticBlastDistance[ArcticBlastLoopIndex] = (ArcticBlastDistance[ArcticBlastLevel[ArcticBlastLoopIndex]] + (ArcticBlastMaxDistance[ArcticBlastLevel[ArcticBlastLoopIndex]] / 50.00))
              • Set ArcticBlastPoint = (Position of ArcticBlastCaster[ArcticBlastLoopIndex])
              • Set ArcticBlastReal = (Facing of ArcticBlastVisualDummyUnit[ArcticBlastLoopIndex])
              • Set ArcticBlastOffset = (ArcticBlastPoint offset by ArcticBlastDistance[ArcticBlastLoopIndex] towards ArcticBlastReal degrees)
              • Unit - Move ArcticBlastVisualDummyUnit[ArcticBlastLoopIndex] instantly to ArcticBlastOffset
              • Set ArcticBlastGroup = (Units within 200.00 of ArcticBlastOffset matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner
              • Unit Group - Pick every unit in ArcticBlastGroup and do (Actions)
                • Loop - Actions
                  • Unit Group - Add (Picked unit) to ArcticBlastDamagedGroup[ArcticBlastLoopIndex]
                  • Set ArcticBlastPickedPoint = (Position of (Picked unit))
                  • Unit - Cause ArcticBlastCaster[ArcticBlastLoopIndex] to damage (Picked unit), dealing ArcticBlastDamage[ArcticBlastLevel[ArcticBlastLoopIndex]] damage of attack type ArcticBlastAttackType and damage type ArcticBlastDamageType
                  • Unit - Create 1 ArcticBlastDummy for (Owner of ArcticBlastCaster[ArcticBlastLoopIndex]) at ArcticBlastPickedPoint facing ArcticBlastPickedPoint
                  • Unit - Add ArcticBlastSlow to (Last created unit)
                  • Unit - Set level of ArcticBlastSlow for (Last created unit) to (Level of ArcticBlast for ArcticBlastCaster[ArcticBlastLoopIndex])
                  • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                  • Special Effect - Create a special effect attached to the origin of (Picked unit) using ArcticBlastDamageEffect
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation(udg_ArcticBlastPickedPoint)
              • Custom script: call DestroyGroup(udg_ArcticBlastGroup)
              • Custom script: call RemoveLocation(udg_ArcticBlastOffset)
              • Custom script: call RemoveLocation(udg_ArcticBlastPoint)
 
Following part:

maxIndex = maxIndex + 1
set unit[maxIndex] = myUnit
set damage[maxIndex] = myDamage
set dummy[maxIndex] = myDummy
... (and so on)

... is called indexing. You do this once when a unit casst a spell to properly add a new instance to your loop elements for periodic trigger.

Now, in your new approach with dynamic indexing you index the very same unit multiple times onCast.
You do this within a loop. That is wrong.
The loop is (or was) only needed to create multiple dummies for an instance, but not for multiple registration of an instance.

I'm not sure if you (still) want to bind multiple dummies to an instance, but I think
you can work only with a group and don't need to index the dummies induvidualy.
(you anyway will index the group they belong too... Set group[maxIndex] = myGroup)

You currently use the CreateGroup() function in custom script without checking
if a group already exists for the group[index] variable. This may lead to a leak as array variables
for instance [0] and [1] are already initialiszed automatically in GUI.
You may use a work around, or just make a check if group doesn't exists. ( if it's equal null)
JASS:
if myGroup == null then
    set myGroup = CreateGroup()
endif
(in custom script... it should work)

You should use a variable prefix for your variables, for example: "AB_"
Then prefix + descrptive name. AB_Target, AB_Caster, and so on for example.

"For each (Integer ArcticBlastLoopIndex) from 1 to ArcticBlastIndex"
...
Something like:
"For each (Integer AB_CurrentIndex) from 1 to AB_MaxIndex"
...
would be more understandable. Or AB_LoopIndex would be ok, too. (the variable names)
 
Level 5
Joined
Jun 28, 2010
Messages
110
Somehow my code work like a mess, still cause serious lag(which is really annoying) and its not MUI.

  • Arctic Blast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arctic Blast
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ArcticBlastIndex Equal to 0
        • Then - Actions
          • Trigger - Turn on Arctic Blast Expand <gen>
        • Else - Actions
      • Set ArcticBlastIndex = (ArcticBlastIndex + 1)
      • Custom script: if udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] == null then
      • Custom script: set udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] = CreateGroup()
      • Custom script: endif
      • Set ArcticBlastCaster[ArcticBlastIndex] = (Triggering unit)
      • Set ArcticBlastLevel[ArcticBlastIndex] = (Level of Arctic Blast for ArcticBlastCaster[ArcticBlastIndex])
      • Set ArcticBlastMaxDistance[ArcticBlastIndex] = ArcticBlastMaxDistance[ArcticBlastLevel[ArcticBlastIndex]]
      • Set ArcticBlastDamage[ArcticBlastIndex] = ArcticBlastDamage[ArcticBlastLevel[ArcticBlastIndex]]
      • Set ArcticBlastSpeed[ArcticBlastIndex] = ArcticBlastSpeed[ArcticBlastLevel[ArcticBlastIndex]]
      • Set ArcticBlastDistance[ArcticBlastIndex] = 0.00
      • Set ArcticBlastPoint = (Position of ArcticBlastCaster[ArcticBlastIndex])
      • Set ArcticBlastReal = 0.00
      • For each (Integer A) from 1 to ArcticBlastEffectAmount, do (Actions)
        • Loop - Actions
          • Set ArcticBlastReal = (ArcticBlastReal + (360.00 / (Real(ArcticBlastEffectAmount))))
          • Set ArcticBlastOffset = (ArcticBlastPoint offset by ArcticBlastDistance[ArcticBlastIndex] towards ArcticBlastReal degrees)
          • Unit - Create 1 ArcticBlastVisualDummy for (Owner of (Triggering unit)) at ArcticBlastOffset facing ArcticBlastReal degrees
          • Unit Group - Add (Last created unit) to ArcticBlastDummyGroup[ArcticBlastIndex]
          • Custom script: call RemoveLocation(udg_ArcticBlastOffset)
      • Unit - Create 1 ArcticBlastDummy for (Owner of ArcticBlastCaster[ArcticBlastIndex]) at ArcticBlastPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to ArcticBlastUnitGroup[ArcticBlastIndex]
      • Custom script: call RemoveLocation(udg_ArcticBlastPoint)
  • Arctic Blast Expand
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ArcticBlastLoopIndex) from 1 to ArcticBlastIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ArcticBlastDistance[ArcticBlastLoopIndex] Greater than or equal to ArcticBlastMaxDistance[ArcticBlastLoopIndex]
            • Then - Actions
              • Unit Group - Remove all units from ArcticBlastDamagedGroup[ArcticBlastLoopIndex]
              • Unit Group - Pick every unit in ArcticBlastDummyGroup[ArcticBlastLoopIndex] and do (Actions)
                • Loop - Actions
                  • Unit - Kill (Picked unit)
              • Unit Group - Pick every unit in ArcticBlastUnitGroup[ArcticBlastLoopIndex] and do (Actions)
                • Loop - Actions
                  • Unit - Remove (Picked unit) from the game
              • Set ArcticBlastLevel[ArcticBlastLoopIndex] = ArcticBlastLevel[ArcticBlastIndex]
              • Set ArcticBlastDummyGroup[ArcticBlastLoopIndex] = ArcticBlastDummyGroup[ArcticBlastIndex]
              • Set ArcticBlastUnitGroup[ArcticBlastLoopIndex] = ArcticBlastUnitGroup[ArcticBlastIndex]
              • Set ArcticBlastDistance[ArcticBlastLoopIndex] = ArcticBlastMaxDistance[ArcticBlastIndex]
              • Set ArcticBlastCaster[ArcticBlastLoopIndex] = ArcticBlastCaster[ArcticBlastIndex]
              • Set ArcticBlastBoolean[ArcticBlastLoopIndex] = ArcticBlastBoolean[ArcticBlastIndex]
              • Set ArcticBlastDamagedGroup[ArcticBlastLoopIndex] = ArcticBlastDamagedGroup[ArcticBlastIndex]
              • Set ArcticBlastMaxDistance[ArcticBlastLoopIndex] = ArcticBlastMaxDistance[ArcticBlastIndex]
              • Set ArcticBlastDamage[ArcticBlastLoopIndex] = ArcticBlastDamage[ArcticBlastIndex]
              • Set ArcticBlastSpeed[ArcticBlastLoopIndex] = ArcticBlastSpeed[ArcticBlastIndex]
              • Set ArcticBlastIndex = (ArcticBlastIndex - 1)
              • Set ArcticBlastLoopIndex = (ArcticBlastLoopIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ArcticBlastIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                  • Game - Display to (All players) for 10.00 seconds the text: Off
                • Else - Actions
            • Else - Actions
              • Set ArcticBlastDistance[ArcticBlastLoopIndex] = (ArcticBlastDistance[ArcticBlastLoopIndex] + (ArcticBlastMaxDistance[ArcticBlastLevel[ArcticBlastLoopIndex]] / 50.00))
              • Set ArcticBlastPoint = (Position of ArcticBlastCaster[ArcticBlastLoopIndex])
              • Unit Group - Pick every unit in ArcticBlastDummyGroup[ArcticBlastLoopIndex] and do (Actions)
                • Loop - Actions
                  • Set ArcticBlastReal = (Facing of (Picked unit))
                  • Set ArcticBlastOffset = (ArcticBlastPoint offset by ArcticBlastDistance[ArcticBlastLoopIndex] towards ArcticBlastReal degrees)
                  • Unit - Move (Picked unit) instantly to ArcticBlastOffset
                  • Set ArcticBlastGroup = (Units within 200.00 of ArcticBlastOffset matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner
                  • Unit Group - Pick every unit in ArcticBlastGroup and do (Actions)
                    • Loop - Actions
                      • Unit Group - Add (Picked unit) to ArcticBlastDamagedGroup[ArcticBlastLoopIndex]
                      • Set ArcticBlastPickedPoint = (Position of (Picked unit))
                      • Unit - Cause ArcticBlastCaster[ArcticBlastLoopIndex] to damage (Picked unit), dealing ArcticBlastDamage[ArcticBlastLevel[ArcticBlastLoopIndex]] damage of attack type ArcticBlastAttackType and damage type ArcticBlastDamageType
                      • Unit - Create 1 ArcticBlastDummy for (Owner of ArcticBlastCaster[ArcticBlastLoopIndex]) at ArcticBlastPickedPoint facing ArcticBlastPickedPoint
                      • Unit - Add ArcticBlastSlow to (Last created unit)
                      • Unit - Set level of ArcticBlastSlow for (Last created unit) to (Level of ArcticBlast for ArcticBlastCaster[ArcticBlastLoopIndex])
                      • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                      • Special Effect - Create a special effect attached to the origin of (Picked unit) using ArcticBlastDamageEffect
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_ArcticBlastPickedPoint)
                  • Custom script: call DestroyGroup(udg_ArcticBlastGroup)
                  • Custom script: call RemoveLocation(udg_ArcticBlastOffset)
              • Custom script: call RemoveLocation(udg_ArcticBlastPoint)
 
Level 5
Joined
Jun 28, 2010
Messages
110
In ArcticBlastUnitGroup is only 1 unit? Why a group?

Where are ArcticBlastUnitGroup[] and ArcticBlastDummyGroup[] initialisized?

You don't destroy groups onDeindex.

My mistake! I found the unit in ArcticBlastUnitGroup does nothing so i did remove it. And here we go again, still not work

  • Arctic Blast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arctic Blast
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ArcticBlastIndex Equal to 0
        • Then - Actions
          • Trigger - Turn on Arctic Blast Expand <gen>
        • Else - Actions
      • Set ArcticBlastIndex = (ArcticBlastIndex + 1)
      • Custom script: if udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] == null then
      • Custom script: set udg_ArcticBlastDamagedGroup[udg_ArcticBlastIndex] = CreateGroup()
      • Custom script: endif
      • Custom script: if udg_ArcticBlastDummyGroup[udg_ArcticBlastIndex] == null then
      • Custom script: set udg_ArcticBlastDummyGroup[udg_ArcticBlastIndex] = CreateGroup()
      • Custom script: endif
      • Set ArcticBlastCaster[ArcticBlastIndex] = (Triggering unit)
      • Set ArcticBlastLevel[ArcticBlastIndex] = (Level of Arctic Blast for ArcticBlastCaster[ArcticBlastIndex])
      • Set ArcticBlastMaxDistance[ArcticBlastIndex] = ArcticBlastMaxDistance[ArcticBlastLevel[ArcticBlastIndex]]
      • Set ArcticBlastDamage[ArcticBlastIndex] = ArcticBlastDamage[ArcticBlastLevel[ArcticBlastIndex]]
      • Set ArcticBlastSpeed[ArcticBlastIndex] = ArcticBlastSpeed[ArcticBlastLevel[ArcticBlastIndex]]
      • Set ArcticBlastDistance[ArcticBlastIndex] = 0.00
      • Set ArcticBlastPoint = (Position of ArcticBlastCaster[ArcticBlastIndex])
      • Set ArcticBlastReal = 0.00
      • For each (Integer A) from 1 to ArcticBlastEffectAmount, do (Actions)
        • Loop - Actions
          • Set ArcticBlastReal = (ArcticBlastReal + (360.00 / (Real(ArcticBlastEffectAmount))))
          • Set ArcticBlastOffset = (ArcticBlastPoint offset by ArcticBlastDistance[ArcticBlastIndex] towards ArcticBlastReal degrees)
          • Unit - Create 1 ArcticBlastVisualDummy for (Owner of (Triggering unit)) at ArcticBlastOffset facing ArcticBlastReal degrees
          • Unit Group - Add (Last created unit) to ArcticBlastDummyGroup[ArcticBlastIndex]
          • Custom script: call RemoveLocation(udg_ArcticBlastOffset)
      • Custom script: call RemoveLocation(udg_ArcticBlastPoint)
  • Arctic Blast Expand
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ArcticBlastLoopIndex) from 1 to ArcticBlastIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ArcticBlastDistance[ArcticBlastLoopIndex] Greater than or equal to ArcticBlastMaxDistance[ArcticBlastLoopIndex]
            • Then - Actions
              • Unit Group - Remove all units from ArcticBlastDamagedGroup[ArcticBlastLoopIndex]
              • Unit Group - Pick every unit in ArcticBlastDummyGroup[ArcticBlastLoopIndex] and do (Actions)
                • Loop - Actions
                  • Unit - Kill (Picked unit)
              • Custom script: call DestroyGroup(udg_ArcticBlastDummyGroup[udg_ArcticBlastLoopIndex])
              • Set ArcticBlastLevel[ArcticBlastLoopIndex] = ArcticBlastLevel[ArcticBlastIndex]
              • Set ArcticBlastDummyGroup[ArcticBlastLoopIndex] = ArcticBlastDummyGroup[ArcticBlastIndex]
              • Set ArcticBlastUnitGroup[ArcticBlastLoopIndex] = ArcticBlastUnitGroup[ArcticBlastIndex]
              • Set ArcticBlastDistance[ArcticBlastLoopIndex] = ArcticBlastMaxDistance[ArcticBlastIndex]
              • Set ArcticBlastCaster[ArcticBlastLoopIndex] = ArcticBlastCaster[ArcticBlastIndex]
              • Set ArcticBlastBoolean[ArcticBlastLoopIndex] = ArcticBlastBoolean[ArcticBlastIndex]
              • Set ArcticBlastDamagedGroup[ArcticBlastLoopIndex] = ArcticBlastDamagedGroup[ArcticBlastIndex]
              • Set ArcticBlastMaxDistance[ArcticBlastLoopIndex] = ArcticBlastMaxDistance[ArcticBlastIndex]
              • Set ArcticBlastDamage[ArcticBlastLoopIndex] = ArcticBlastDamage[ArcticBlastIndex]
              • Set ArcticBlastSpeed[ArcticBlastLoopIndex] = ArcticBlastSpeed[ArcticBlastIndex]
              • Set ArcticBlastIndex = (ArcticBlastIndex - 1)
              • Set ArcticBlastLoopIndex = (ArcticBlastLoopIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ArcticBlastIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                  • Game - Display to (All players) for 10.00 seconds the text: Off
                • Else - Actions
            • Else - Actions
              • Set ArcticBlastDistance[ArcticBlastLoopIndex] = (ArcticBlastDistance[ArcticBlastLoopIndex] + (ArcticBlastMaxDistance[ArcticBlastLevel[ArcticBlastLoopIndex]] / 50.00))
              • Set ArcticBlastPoint = (Position of ArcticBlastCaster[ArcticBlastLoopIndex])
              • Unit Group - Pick every unit in ArcticBlastDummyGroup[ArcticBlastLoopIndex] and do (Actions)
                • Loop - Actions
                  • Set ArcticBlastReal = (Facing of (Picked unit))
                  • Set ArcticBlastOffset = (ArcticBlastPoint offset by ArcticBlastDistance[ArcticBlastLoopIndex] towards ArcticBlastReal degrees)
                  • Unit - Move (Picked unit) instantly to ArcticBlastOffset
                  • Set ArcticBlastGroup = (Units within 200.00 of ArcticBlastOffset matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner
                  • Unit Group - Pick every unit in ArcticBlastGroup and do (Actions)
                    • Loop - Actions
                      • Unit Group - Add (Picked unit) to ArcticBlastDamagedGroup[ArcticBlastLoopIndex]
                      • Set ArcticBlastPickedPoint = (Position of (Picked unit))
                      • Unit - Cause ArcticBlastCaster[ArcticBlastLoopIndex] to damage (Picked unit), dealing ArcticBlastDamage[ArcticBlastLevel[ArcticBlastLoopIndex]] damage of attack type ArcticBlastAttackType and damage type ArcticBlastDamageType
                      • Unit - Create 1 ArcticBlastDummy for (Owner of ArcticBlastCaster[ArcticBlastLoopIndex]) at ArcticBlastPickedPoint facing ArcticBlastPickedPoint
                      • Unit - Add ArcticBlastSlow to (Last created unit)
                      • Unit - Set level of ArcticBlastSlow for (Last created unit) to (Level of ArcticBlast for ArcticBlastCaster[ArcticBlastLoopIndex])
                      • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                      • Special Effect - Create a special effect attached to the origin of (Picked unit) using ArcticBlastDamageEffect
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_ArcticBlastPickedPoint)
                  • Custom script: call DestroyGroup(udg_ArcticBlastGroup)
                  • Custom script: call RemoveLocation(udg_ArcticBlastOffset)
              • Custom script: call RemoveLocation(udg_ArcticBlastPoint)
 
Level 5
Joined
Jun 28, 2010
Messages
110
The current code is anyway not up to date and there are more critical flaws.
Mind to update it and possibly even remove not needed operations to gain readability?
Also Debug, Debug, Debug! Always print messages and try to find out what exactly works and what not.

I think we should discuss this in my Spell Topic. Your lastest question by yesterday, i replied it in my Spell Topic, check it out.
 
Status
Not open for further replies.
Top