• 🏆 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] First instance problem

Status
Not open for further replies.
Level 16
Joined
Jun 24, 2009
Messages
1,409
I am making request which is an instant no target spell that freezes time and units around the caster. The problem is that at the first cast the units remains paused and the dummy remains there.
All other instances are okay.
  • Fuzetsu
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fuzetsu
    • Actions
      • Set FGet = False
      • For each (Integer A) from 1 to FMax, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FGet Equal to False
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FRecycle[(Integer A)] Equal to True
                • Then - Actions
                  • Set FIndex = (Integer A)
                  • Set FGet = True
                  • Custom script: set udg_FFreezeGroup[udg_FIndex] = CreateGroup()
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer A) Equal to FMax
                    • Then - Actions
                      • Set FMax = (FMax + 1)
                    • Else - Actions
            • Else - Actions
      • Set FCaster[FIndex] = (Triggering unit)
      • Set FCastPoint[FIndex] = (Position of FCaster[FIndex])
      • Set FTimer[FIndex] = (2.50 + (Real((Level of Fuzetsu for FCaster[FIndex]))))
      • Set FFreezeGroup[FIndex] = (Units within 750.00 of FCastPoint[FIndex] matching ((((Matching unit) is alive) Equal to True) and ((Matching unit) Not equal to FCaster[FIndex])))
      • Unit - Create 1 Sphere for Neutral Passive at FCastPoint[FIndex] facing Default building facing degrees
      • Set FDummy[FIndex] = (Last created unit)
      • Unit Group - Pick every unit in FFreezeGroup[FIndex] and do (Actions)
        • Loop - Actions
          • Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
          • Unit - Pause (Picked unit)
      • Set FHas[FIndex] = True
      • Set FRecycle[FIndex] = False
      • Set FCount = (FCount + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Fuzetsu Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Fuzetsu Loop <gen>
        • Else - Actions
  • Fuzetsu Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer FInteger) from 1 to FMax, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FHas[FInteger] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FTimer[FInteger] Greater than 0.00
                • Then - Actions
                  • Set FTimer[FInteger] = (FTimer[FInteger] - 0.03)
                  • Set FTempGroup = (Units within 750.00 of FCastPoint[FInteger] matching ((((Matching unit) is alive) Equal to True) and ((Matching unit) Not equal to FCaster[FInteger])))
                  • Unit Group - Pick every unit in FTempGroup and do (Actions)
                    • Loop - Actions
                      • Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
                      • Unit - Pause (Picked unit)
                      • Unit Group - Add (Picked unit) to FFreezeGroup[FInteger]
                  • Custom script: call DestroyGroup (udg_FTempGroup)
                • Else - Actions
                  • Unit Group - Pick every unit in FFreezeGroup[FInteger] and do (Actions)
                    • Loop - Actions
                      • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
                      • Unit - Unpause (Picked unit)
                  • Set FHas[FInteger] = False
                  • Set FCount = (FCount - 1)
                  • Unit - Remove FDummy[FInteger] from the game
                  • Unit Group - Remove all units from FFreezeGroup[FInteger]
                  • Custom script: call RemoveLocation (udg_FCastPoint[udg_FInteger])
            • Else - Actions
              • Set FRecycle[FInteger] = True
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FCount Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
During the first cast, this will be false: FRecycle[(Integer A)] so it will not create the group.

And the indexing isn't good. You never subtract from FMax. You don't have to create a group when an index is recycled since you are not destroying it. Currently it's leaking. Also setting FGet = False and then looping from 1 to FMax and testing whether it is true or false is stupid. I have a feeling I have already told you that before.
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
During the first cast, this will be false: FRecycle[(Integer A)] so it will not create the group.

And the indexing isn't good. You never subtract from FMax. You don't have to create a group when an index is recycled since you are not destroying it. Currently it's leaking. Also setting FGet = False and then looping from 1 to FMax and testing whether it is true or false is stupid. I have a feeling I have already told you that before.

FRecycle is an initially True variable so this isn't the problem. And I have a feeling that i have already told you that the get part is required for that index system.
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
Well now I checked Hanky's DIR now the first instance works but other ones sometimes not. So no where is the problem?
  • Fuzetsu
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fuzetsu
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FIndexS Equal to 0
        • Then - Actions
          • Trigger - Turn on Fuzetsu Loop <gen>
        • Else - Actions
      • Set FIndexS = (FIndexS + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FIndexS Greater than FMax
        • Then - Actions
          • Set FIndex[FIndexS] = FIndexS
          • Set FMax = FIndexS
        • Else - Actions
      • Set TempInt = FIndex[FIndexS]
      • Set FCastPoint[TempInt] = (Position of (Triggering unit))
      • Set FCaster[TempInt] = (Triggering unit)
      • Unit - Create 1 Sphere for Neutral Passive at FCastPoint[TempInt] facing Default building facing degrees
      • Set FDummy[TempInt] = (Last created unit)
      • Custom script: set udg_FFreezeGroup[udg_TempInt] = CreateGroup()
      • Set FFreezeGroup[TempInt] = (Units within 750.00 of FCastPoint[TempInt] matching ((((Matching unit) is alive) Equal to True) and ((Matching unit) Not equal to FCaster[TempInt])))
      • Unit Group - Pick every unit in FFreezeGroup[TempInt] and do (Actions)
        • Loop - Actions
          • Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
          • Unit - Pause (Picked unit)
      • Set FTimer[TempInt] = (2.50 + (Real((Level of Fuzetsu for FCaster[TempInt]))))
  • Fuzetsu Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer FInteger) from 1 to FIndexS, do (Actions)
        • Loop - Actions
          • Set TempInt = FIndex[FInteger]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FTimer[TempInt] Greater than 0.00
            • Then - Actions
              • Set FTimer[TempInt] = (FTimer[TempInt] - 0.03)
              • Set FTempGroup = (Units within 750.00 of FCastPoint[TempInt] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is in FFreezeGroup[TempInt]) Equal to False) and ((Matching unit) Not equal to FCaster[TempInt]))))
              • Unit Group - Pick every unit in FTempGroup and do (Actions)
                • Loop - Actions
                  • Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
                  • Unit - Pause (Picked unit)
                  • Unit Group - Add (Picked unit) to FFreezeGroup[TempInt]
              • Custom script: call DestroyGroup (udg_FTempGroup)
            • Else - Actions
              • Unit - Remove FDummy[TempInt] from the game
              • Unit Group - Pick every unit in FFreezeGroup[TempInt] and do (Actions)
                • Loop - Actions
                  • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
                  • Unit - Unpause (Picked unit)
              • Unit Group - Remove all units from FFreezeGroup[TempInt]
              • Set FIndex[FIndexS] = FIndex[FIndexS]
              • Set FIndex[FIndexS] = TempInt
              • Set FIndexS = (FIndexS - 1)
              • Set FInteger = (FInteger - 1)
              • Custom script: call RemoveLocation (udg_FCastPoint[udg_TempInt])
              • Custom script: call DestroyGroup (udg_FFreezeGroup[udg_TempInt])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FIndexS Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
View attachment spell.w3x
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
You don't need to create the group with the custom script, then GUI function does that.

I tested it and couldn't make it not work.

As a side note, this
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • FIndexS Equal to 0
    • Then - Actions
      • Trigger - Turn off (This trigger)
    • Else - Actions
should be after this
  • Set FIndexS = (FIndexS - 1)
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
but it's an array group and if I don't create it the spell not work

well... cast it 2 times: once to pause the other hero and then again anywhere if it hit's the hero or just cast it several times not far from each other
I haven't modified this part of the DIR
 
Status
Not open for further replies.
Top