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

First time to use that array indexing system.

Status
Not open for further replies.

  • Blizzard Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Blizzard
    • Actions
      • Set Temp_Unit = (Triggering unit)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Blizz_Size Equal to (==) 0
          • Then - Actions
            • Trigger - Turn on Blizzard Loop Copy <gen>
          • Else - Actions
      • Set Blizz_Size = (Blizz_Size + 1)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Blizz_Size Greater than (>) Blizz_MaxSize
          • Then - Actions
            • Set Blizz_Index[Blizz_Size] = Blizz_Size
            • Set Blizz_MaxSize = Blizz_Size
          • Else - Actions
      • Set Blizz_TempInt = Blizz_Index[Blizz_Size]
      • Set Blizz_Caster[Blizz_TempInt] = Temp_Unit
      • Set Blizz_Boolean[Blizz_TempInt] = True
      • Set Blizz_TargetPoint[Blizz_TempInt] = (Target point of ability being cast)
      • Set Blizz_RealTimer[Blizz_TempInt] = 1.00
      • Set Temp_Rect = (Region centered at Blizz_TargetPoint[Blizz_TempInt] with size (500.00, 500.00))
        • Do Multiple ActionsFor each (Integer A) from 1 to 10, do (Actions)
          • Loop - Actions
            • Set Temp_Point = (Random point in Temp_Rect)
            • Set Temp_UG = (Units within 200.00 of Temp_Point)
            • Unit Group - Pick every unit in Temp_UG and do (Actions)
              • Loop - Actions
                • Unit - Create 1 DUMMY for (Owner of (Triggering unit)) at Temp_Point facing Default building facing (270.0) degrees
                • Unit - Cause (Last created unit) to damage (Picked unit), dealing 25.00 damage of attack type Spells and damage type Normal
                • Unit - Add a 1.10 second Generic expiration timer to (Last created unit)
            • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Human\Blizzard\BlizzardTarget.mdl
            • Special Effect - Destroy (Last created special effect)
            • Custom script: call DestroyGroup(udg_Temp_UG)
            • Custom script: call RemoveLocation(udg_Temp_Point)
      • Custom script: call RemoveRect(udg_Temp_Rect)
      • Custom script: set udg_Blizz_Handle=udg_Temp_Unit
      • Trigger - Run CreateDHashtable <gen> (ignoring conditions)
      • Set Blizz_HashID[Blizz_TempInt] = Blizz_Index[Blizz_Size]
  • Blizzard Loop Copy
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer Blizz_Loop) from 1 to Blizz_Size, do (Actions)
        • Loop - Actions
          • Set Blizz_TempInt = Blizz_Index[Blizz_Loop]
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Blizz_Boolean[Blizz_TempInt] Equal to (==) True
              • Then - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Blizz_RealTimer[Blizz_TempInt] Less than or equal to (<=) 0.00
                  • Then - Actions
                    • Unit - Set mana of Blizz_Caster[Blizz_TempInt] to ((Mana of Blizz_Caster[Blizz_TempInt]) - 50.00)
                    • Set Temp_Rect = (Region centered at Blizz_TargetPoint[Blizz_TempInt] with size (500.00, 500.00))
                      • Do Multiple ActionsFor each (Integer A) from 1 to 10, do (Actions)
                        • Loop - Actions
                          • Set Temp_Point = (Random point in Temp_Rect)
                          • Set Temp_UG = (Units within 200.00 of Temp_Point)
                          • Unit Group - Pick every unit in Temp_UG and do (Actions)
                            • Loop - Actions
                              • Unit - Create 1 DUMMY for Blizz_Caster[Blizz_TempInt] at Temp_Point facing Default building facing (270.0) degrees
                              • Unit - Cause (Last created unit) to damage (Picked unit), dealing 25.00 damage of attack type Spells and damage type Normal
                              • Unit - Add a 1.10 second Generic expiration timer to (Last created unit)
                          • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Human\Blizzard\BlizzardTarget.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: call DestroyGroup(udg_Temp_UG)
                          • Custom script: call RemoveLocation(udg_Temp_Point)
                    • Custom script: call RemoveRect(udg_Temp_Rect)
                    • Set Blizz_RealTimer[Blizz_TempInt] = 1.00
                  • Else - Actions
                    • Set Blizz_RealTimer[Blizz_TempInt] = (Blizz_RealTimer[Blizz_TempInt] - 0.10)
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Mana of Blizz_Caster[Blizz_TempInt]) Less than (<) 25.00
                  • Then - Actions
                    • Unit - Order Blizz_Caster[Blizz_TempInt] to Stop
                  • Else - Actions
              • Else - Actions
                • Custom script: call RemoveLocation(udg_Blizz_TargetPoint[udg_Blizz_TempInt])
                • Set Blizz_Index[Blizz_Loop] = Blizz_Index[Blizz_Size]
                • Set Blizz_Index[Blizz_Size] = Blizz_TempInt
                • Set Blizz_Size = (Blizz_Size - 1)
                • Set Blizz_Loop = (Blizz_Loop - 1)
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Blizz_Size Equal to (==) 0
              • Then - Actions
                • Trigger - Turn off (This trigger)
              • Else - Actions
  • Blizzard End
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to (==) Blizzard
    • Actions
      • Set Temp_Unit = (Triggering unit)
      • Custom script: set udg_Blizz_Handle=udg_Temp_Unit
      • Trigger - Run GetDHashtable <gen> (ignoring conditions)
      • Set Blizz_Boolean[Blizz_HashID[Blizz_TempInt]] = False
      • Trigger - Run DeleteDHashtable <gen> (ignoring conditions)


Okay, I'm making a realistic Blizzard that only damages only those who are hit by the shards. Came out very well, but has one major problems. (And yes, it is based on Hanky's GUI Indexing tutorial on the spells section.)

There is a 1-2 second delay before the first wave of shards appears when it's casted.

That's the problem.

Thanks for your help!
~supertoinkz

ALSO!
How to make it less laggy D:
 
You know, no ones tried replacing! All those knockback spells and stuff, they go by increasing the MAXIMUM number of the index, however, this fixes that.
For example, in NFWar's missile system, there are BS_Missile[1],BS_Missile[3],BS_Missile[4] and BS_Missile[5]. As you can see, there is no BS_Missile[2].
So, in normal MUI spells, it would just create a BS_Missile[6], but with this simple code, it replaces an unused BS_Missile[].
  • Basic Loop Setup
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • -------- You've got your generic Event --------
      • -------- --------
      • -------- You can add your own conditions --------
      • -------- --------
      • -------- But wait! Look at the action below! --------
      • -------- I used 'TheLoopChecker' as the index in this example --------
      • For each (Integer TheLoopChecker) from 0 to BL_Index, do (Actions)
        • Loop - Actions
          • -------- It's a miracle! Jesus is born! --------
          • -------- GeneralBoolean is just something to signify that the current Index is not taken up --------
          • -------- Only works IF the index is lesser than the max index --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BL_GeneralBoolean[TheLoopChecker] Equal to False
              • TheLoopChecker Less than BL_Index
            • Then - Actions
              • -------- If it is not taken up, then do --------
              • -------- The same methods except use --------
              • -------- TheLoopChecker as the index --------
              • -------- There is no need for Set Index = (Index + 1) --------
              • -------- Or anything else like that --------
              • -------- Because it isn't ADDING, it is replacing --------
              • Set BL_GeneralBoolean[TheLoopChecker] = True
              • -------- You don't need Turn on 'Your Loop Trigger' <gen> either, for the same reasons --------
              • Skip remaining actions
            • Else - Actions
              • -------- If the index exists, and it is at its largest --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TheLoopChecker Greater than or equal to BL_Index
                • Then - Actions
                  • -------- Then, and only then, do your generic actions --------
                  • Set BL_Index = (BL_Index + 1)
                  • Set BL_Skip = (BL_Skip + 1)
                  • Set BL_GeneralBoolean[BL_Index] = True
                  • Trigger - Turn on Generic Looping Trigger <gen>
                • Else - Actions
Basically, the above code can reduce lag with a little extra work and no extra variables (you can replace 'TheLoopChecker' with Integer A or Integer B).
 
Status
Not open for further replies.
Top