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

Something Wrong with my Dynamic Indexing?

Status
Not open for further replies.
Level 11
Joined
Aug 6, 2009
Messages
697
I've been trying to figure out how to fix this issues and it's been a huge pain.
After me and a friend tried fixing the problem in many different ways we're still left with the same result.
The problem is that the dummy units aren't being removed after the first use.
We've tried setting them as individual variables.
We've tried not using the "global_" arrays and created individual variables for the indexing.
Here's the unmodified triggers


  • KamehamehaAct
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Instant Kamehameha
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Global_CurrentIndex[1] Equal to 0
        • Then - Actions
          • Trigger - Turn on KamehamehaLoop <gen>
        • Else - Actions
      • Set Global_CurrentIndex[1] = (Global_CurrentIndex[1] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Global_CurrentIndex[1] Greater than Global_MaxIndex[1]
        • Then - Actions
          • Set Global_Index[Global_CurrentIndex[1]] = Global_CurrentIndex[1]
          • Set Global_MaxIndex[1] = Global_CurrentIndex[1]
        • Else - Actions
      • Set TempInt = Global_Index[Global_CurrentIndex[1]]
      • Set IK_Caster[TempInt] = (Triggering unit)
      • Set IK_Victim[TempInt] = (Target unit of ability being cast)
      • Set IK_Duration[TempInt] = 7.39
      • Set IK_Duration2[TempInt] = 0.49
      • Set IK_Duration3[TempInt] = 4.00
      • Set IK_DummyMade[TempInt] = False
      • Unit - Pause IK_Caster[TempInt]
      • Unit - Pause IK_Victim[TempInt]
      • Unit - Add Storm Crow Form to IK_Caster[TempInt]
      • Animation - Play IK_Caster[TempInt]'s Spell Channel animation
      • Animation - Change IK_Caster[TempInt] flying height to 620.00 at 0.00
      • Special Effect - Create a special effect attached to the right hand of IK_Caster[TempInt] using war3mapImported\Bibang.mdx
      • Set IK_Effects[TempInt] = (Last created special effect)
      • Sound - Play Kamehame <gen>
      • Unit - Make IK_Caster[TempInt] Invulnerable
      • Unit - Make IK_Victim[TempInt] Invulnerable

  • KamehamehaLoop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Global_Loop[1]) from 1 to Global_CurrentIndex[1], do (Actions)
        • Loop - Actions
          • Set TempInt = Global_Index[Global_Loop[1]]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IK_Duration[TempInt] Greater than 0.00
            • Then - Actions
              • Set IK_Duration[TempInt] = (IK_Duration[TempInt] - 0.05)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IK_Duration2[TempInt] Greater than 0.00
                • Then - Actions
                  • Special Effect - Destroy IK_Effects[TempInt]
                  • Set IK_Duration2[TempInt] = (IK_Duration2[TempInt] - 0.05)
                  • Sound - Play teleport <gen>
                  • Set TempPoint = (Position of IK_Victim[TempInt])
                  • Set IK_Angle[TempInt] = (Angle from TempPoint to (TempPoint offset by 125.00 towards (Facing of IK_Victim[TempInt]) degrees))
                  • Set TempPoint2 = (TempPoint offset by 135.00 towards IK_Angle[TempInt] degrees)
                  • Unit - Move IK_Caster[TempInt] instantly to TempPoint2, facing (Position of IK_Victim[TempInt])
                  • Animation - Change IK_Caster[TempInt] flying height to 0.00 at 0.00
                  • Unit - Remove Storm Crow Form from IK_Caster[TempInt]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • IK_Duration3[TempInt] Greater than 0.00
                    • Then - Actions
                      • Sound - Play HAAAAAAA <gen>
                      • Unit - Make IK_Caster[TempInt] Vulnerable
                      • Unit - Make IK_Victim[TempInt] Vulnerable
                      • Set IK_Duration3[TempInt] = (IK_Duration3[TempInt] - 0.05)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • IK_DummyMade[TempInt] Equal to False
                        • Then - Actions
                          • Animation - Play IK_Caster[TempInt]'s Spell Throw animation
                          • Set IK_DummyMade[TempInt] = True
                          • Set TempPoint = (Position of IK_Caster[TempInt])
                          • Set IK_Angle[TempInt] = (Angle from (Position of IK_Caster[TempInt]) to (Position of IK_Victim[TempInt]))
                          • Set TempPoint2 = (TempPoint offset by 25.00 towards IK_Angle[TempInt] degrees)
                          • Unit - Create 1 Instant KamehamehaDummy for (Owner of IK_Caster[TempInt]) at TempPoint2 facing IK_Angle[TempInt] degrees
                          • Set IK_DummyUnit[TempInt] = (Last created unit)
                          • Unit Group - Add (Last created unit) to IK_DummyGroup[TempInt]
                          • Custom script: call RemoveLocation(udg_TempPoint)
                          • Custom script: call RemoveLocation(udg_TempPoint2)
                        • Else - Actions
                          • Set TempPoint = (Position of IK_DummyUnit[TempInt])
                          • Set IK_Angle[TempInt] = (Angle from (Position of IK_Caster[TempInt]) to (Position of IK_Victim[TempInt]))
                          • Set TempPoint2 = (TempPoint offset by 25.00 towards IK_Angle[TempInt] degrees)
                          • Unit - Create 1 Instant KamehamehaDummy for (Owner of IK_Caster[TempInt]) at TempPoint2 facing IK_Angle[TempInt] degrees
                          • Unit - Move IK_DummyUnit[TempInt] instantly to TempPoint2
                          • Unit Group - Add (Last created unit) to IK_DummyGroup[TempInt]
                          • Custom script: call RemoveLocation(udg_TempPoint)
                          • Custom script: call RemoveLocation(udg_TempPoint2)
                          • Unit Group - Pick every unit in IK_DummyGroup[TempInt] and do (Actions)
                            • Loop - Actions
                              • Unit Group - Pick every unit in (Units within 350.00 of (Position of (Picked unit)) matching (((Owner of (Matching unit)) is an enemy of (Owner of IK_Caster[TempInt])) Equal to True)) and do (Unit - Cause IK_Caster[TempInt] to damage (Picked unit), dealing ((Real((Level of Instant Kamehameha for IK_Caster[TempInt]))) x 1.00) damage of attack type Chaos and damage type Normal)
                    • Else - Actions
                      • Set Global_Index[Global_Loop[1]] = Global_Index[Global_CurrentIndex[1]]
                      • Set Global_Index[Global_CurrentIndex[1]] = TempInt
                      • Set Global_CurrentIndex[1] = (Global_CurrentIndex[1] - 1)
                      • Set Global_Loop[1] = (Global_Loop[1] - 1)
                      • Unit - Unpause IK_Caster[TempInt]
                      • Unit - Unpause IK_Victim[TempInt]
                      • Unit Group - Pick every unit in IK_DummyGroup[TempInt] and do (Unit - Remove (Picked unit) from the game)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Global_CurrentIndex[1] Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Skip remaining actions
        • Else - Actions


  • KamehamehaAct
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Instant Kamehameha
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IK_CurrentIndex Equal to 0
        • Then - Actions
          • Trigger - Turn on KamehamehaLoop <gen>
        • Else - Actions
      • Set IK_CurrentIndex = (IK_CurrentIndex + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IK_CurrentIndex Greater than IK_MaxIndex
        • Then - Actions
          • Set IK_Index[IK_CurrentIndex] = IK_CurrentIndex
          • Set IK_MaxIndex = IK_CurrentIndex
        • Else - Actions
      • Set TempInt = IK_Index[IK_CurrentIndex]
      • Set IK_Caster[TempInt] = (Triggering unit)
      • Set IK_Victim[TempInt] = (Target unit of ability being cast)
      • Set IK_Duration[TempInt] = 7.39
      • Set IK_Duration2[TempInt] = 0.49
      • Set IK_Duration3[TempInt] = 4.00
      • Set IK_DummyMade[TempInt] = False
      • Set IK_AmountOfDummies[TempInt] = 0
      • Unit - Pause IK_Caster[TempInt]
      • Unit - Pause IK_Victim[TempInt]
      • Unit - Add Storm Crow Form to IK_Caster[TempInt]
      • Animation - Play IK_Caster[TempInt]'s Spell Channel animation
      • Animation - Change IK_Caster[TempInt] flying height to 620.00 at 0.00
      • Special Effect - Create a special effect attached to the right hand of IK_Caster[TempInt] using war3mapImported\Bibang.mdx
      • Set IK_Effects[TempInt] = (Last created special effect)
      • Sound - Play Kamehame <gen>
      • Unit - Make IK_Caster[TempInt] Invulnerable
      • Unit - Make IK_Victim[TempInt] Invulnerable

  • KamehamehaLoop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer IK_Loop) from 1 to IK_CurrentIndex, do (Actions)
        • Loop - Actions
          • Set TempInt = IK_Index[IK_Loop]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IK_Duration[TempInt] Greater than 0.00
            • Then - Actions
              • Set IK_Duration[TempInt] = (IK_Duration[TempInt] - 0.05)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IK_Duration2[TempInt] Greater than 0.00
                • Then - Actions
                  • Special Effect - Destroy IK_Effects[TempInt]
                  • Set IK_Duration2[TempInt] = (IK_Duration2[TempInt] - 0.05)
                  • Sound - Play teleport <gen>
                  • Set TempPoint = (Position of IK_Victim[TempInt])
                  • Set IK_Angle[TempInt] = (Angle from TempPoint to (TempPoint offset by 125.00 towards (Facing of IK_Victim[TempInt]) degrees))
                  • Set TempPoint2 = (TempPoint offset by 135.00 towards IK_Angle[TempInt] degrees)
                  • Unit - Move IK_Caster[TempInt] instantly to TempPoint2, facing (Position of IK_Victim[TempInt])
                  • Animation - Change IK_Caster[TempInt] flying height to 0.00 at 0.00
                  • Unit - Remove Storm Crow Form from IK_Caster[TempInt]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • IK_Duration3[TempInt] Greater than 0.00
                    • Then - Actions
                      • Sound - Play HAAAAAAA <gen>
                      • Unit - Make IK_Caster[TempInt] Vulnerable
                      • Unit - Make IK_Victim[TempInt] Vulnerable
                      • Set IK_Duration3[TempInt] = (IK_Duration3[TempInt] - 0.05)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • IK_DummyMade[TempInt] Equal to False
                        • Then - Actions
                          • Animation - Play IK_Caster[TempInt]'s Spell Throw animation
                          • Set IK_DummyMade[TempInt] = True
                          • Set TempPoint = (Position of IK_Caster[TempInt])
                          • Set IK_Angle[TempInt] = (Angle from (Position of IK_Caster[TempInt]) to (Position of IK_Victim[TempInt]))
                          • Set TempPoint2 = (TempPoint offset by 25.00 towards IK_Angle[TempInt] degrees)
                          • Unit - Create 1 Instant KamehamehaDummy for (Owner of IK_Caster[TempInt]) at TempPoint2 facing IK_Angle[TempInt] degrees
                          • Set IK_DummyUnit[TempInt] = (Last created unit)
                          • Custom script: call RemoveLocation(udg_TempPoint)
                          • Custom script: call RemoveLocation(udg_TempPoint2)
                        • Else - Actions
                          • Set TempPoint = (Position of IK_DummyUnit[TempInt])
                          • Set IK_Angle[TempInt] = (Angle from (Position of IK_Caster[TempInt]) to (Position of IK_Victim[TempInt]))
                          • Set TempPoint2 = (TempPoint offset by 25.00 towards IK_Angle[TempInt] degrees)
                          • Unit - Create 1 Instant KamehamehaDummy for (Owner of IK_Caster[TempInt]) at TempPoint2 facing IK_Angle[TempInt] degrees
                          • Unit - Move IK_DummyUnit[TempInt] instantly to TempPoint2
                          • Set IK_AmountOfDummies[TempInt] = (IK_AmountOfDummies[TempInt] + 1)
                          • Set IK_AmountOfDummies2[TempInt] = IK_AmountOfDummies[TempInt]
                          • Set IK_DummyUnits[IK_AmountOfDummies[TempInt]] = (Last created unit)
                          • Custom script: call RemoveLocation(udg_TempPoint)
                          • Custom script: call RemoveLocation(udg_TempPoint2)
                    • Else - Actions
                      • For each (Integer IK_DummyLoop[TempInt]) from 1 to IK_AmountOfDummies[TempInt], do (Actions)
                        • Loop - Actions
                          • Unit - Remove IK_DummyUnits[IK_AmountOfDummies2[TempInt]] from the game
                          • Set IK_AmountOfDummies2[TempInt] = (IK_AmountOfDummies2[TempInt] - 1)
                      • Unit - Remove IK_DummyUnit[TempInt] from the game
                      • Unit - Unpause IK_Victim[TempInt]
                      • Unit - Unpause IK_Caster[TempInt]
                      • Set IK_Index[IK_Loop] = IK_Index[IK_CurrentIndex]
                      • Set IK_Index[IK_CurrentIndex] = TempInt
                      • Set IK_CurrentIndex = (IK_CurrentIndex - 1)
                      • Set IK_Loop = (IK_Loop - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IK_Loop Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Skip remaining actions
        • Else - Actions
 
Status
Not open for further replies.
Top