• 🏆 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] Periodic Event

Status
Not open for further replies.
Level 17
Joined
Jun 17, 2010
Messages
2,275
  • Soar Expiration
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to Soar_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Soar_Expiration[(Integer A)] Greater than or equal to (Soar_ExpirationFormula - 1)
            • Then - Actions
              • Set ExpirationBoolean[(Integer A)] = False
              • Set Soar_Expiration[(Integer A)] = 0
              • Unit - Remove Dive Bomb from Soar_Unit[(Integer A)]
              • Player - Enable Soar for (Owner of Soar_Unit[(Integer A)])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ExpirationBoolean[(Integer A)] Equal to True
                • Then - Actions
                  • Animation - Change Soar_Unit[(Integer A)] flying height to ((Current flying height of Soar_Unit[(Integer A)]) - (400.00 / (Real(Soar_ExpirationFormula)))) at 0.00
                  • Set Soar_Expiration[(Integer A)] = (Soar_Expiration[(Integer A)] + 1)
                • Else - Actions
when i use it, it works and stops for 1 second, then it keeps moving height down whenever i increase it.
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
its a constant so its the same for everyone, so it doesnt need an array
So the trigger stops a second earlier.

  • Set Soar_ExpirationFormula = (((Level of Soar for (Triggering unit)) x 2) + 6)
hm.... it needs an array doesnt it... crap... but i dont think thats the problem, because i only tested it for 1 character 1 player
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Those are wierd:
  • Set Soar_Expiration[(Integer A)] Greater than or equal to (Soar_ExpirationFormula - 1)
And:
  • Set Soar_Expiration[(Integer A)] = (Soar_Expiration[(Integer A)] + 1)
Elaborate the subject and show other triggers that interact with this one. Replace Integer A with integer variable created by your onw, it's saver.
 
No, that is no constant. A constant would be
  • Set Soar_ExpirationFormula = 2
This is level dependent and each spell cast will replace the previous one.

You use this:
  • Set Soar_Expiration[(Integer A)] = 0
shouldn't it be:
  • Set Soar_Expiration[(Integer A)] = (Soar_Expiration[(IntegerA)] - 1.00)
Don't use (Integer A) for custom systems/spells. Use a custom variable; triggers that use Integer A at the same time will make the system/spell malfunction.

Tell us how the spell works or post a test map.
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
  • Soar
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Soar
    • Actions
      • -------- ---------------------------------------------------------------- --------
      • -------- This first variable recycles the DB_Index. --------
      • -------- ---------------------------------------------------------------- --------
      • Set DB_Index = (DB_Index - 1)
      • -------- -------------------------------------------------------------------------------------------------------------------------- --------
      • -------- Ensures that when soaring, movement speed from Feather Weight is doubled. --------
      • -------- -------------------------------------------------------------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Feather Weight for (Triggering unit)) Greater than 0
        • Then - Actions
          • For each (Integer A) from 1 to FW_Index, do (Actions)
            • Loop - Actions
              • -------- The ability is rigged with 6 levels. --------
              • Unit - Set level of FW Dummy Spell for FW_DummyUnit[(Integer A)] to ((Level of FW Dummy Spell for FW_DummyUnit[(Integer A)]) + 3)
        • Else - Actions
      • -------- ---------------------------------------------------------------------------------------------------------- --------
      • -------- The actual Soar ability starts here. The Index makes the ability MUI. --------
      • -------- ---------------------------------------------------------------------------------------------------------- --------
      • Set Soar_Index = (Soar_Index + 1)
      • Set Soar_Expiration[Soar_Index] = 0
      • Set Soar_ExpirationFormula = (((Level of Soar for (Triggering unit)) x 2) + 6)
      • Set Soar_Level[Soar_Index] = (Level of (Ability being cast) for (Triggering unit))
      • Set Soar_Unit[Soar_Index] = (Triggering unit)
      • Set HeightBoolean[Soar_Index] = True
      • Unit - Add Dive Bomb to (Triggering unit)
      • Unit - Set level of Dive Bomb for (Triggering unit) to Soar_Level[Soar_Index]
      • Player - Disable Soar for (Owner of (Triggering unit))
  • Soar Height
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to Soar_Index, 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
                  • HeightBoolean[(Integer A)] Equal to True
                  • (Current flying height of Soar_Unit[(Integer A)]) Less than 500.00
            • Then - Actions
              • Animation - Change Soar_Unit[(Integer A)] flying height to ((Current flying height of Soar_Unit[(Integer A)]) + 50.00) at 0.00
            • Else - Actions
              • Set HeightBoolean[(Integer A)] = False
              • Set ExpirationBoolean[Soar_Index] = True
  • Soar Expiration
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to Soar_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Soar_Expiration[(Integer A)] Greater than or equal to (Soar_ExpirationFormula - 1)
            • Then - Actions
              • Set ExpirationBoolean[(Integer A)] = False
              • Set Soar_Expiration[(Integer A)] = 0
              • Unit - Remove Dive Bomb from Soar_Unit[(Integer A)]
              • Player - Enable Soar for (Owner of Soar_Unit[(Integer A)])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ExpirationBoolean[(Integer A)] Equal to True
                • Then - Actions
                  • Animation - Change Soar_Unit[(Integer A)] flying height to ((Current flying height of Soar_Unit[(Integer A)]) - (400.00 / (Real(Soar_ExpirationFormula)))) at 0.00
                  • Set Soar_Expiration[(Integer A)] = (Soar_Expiration[(Integer A)] + 1)
                • Else - Actions
  • Dive Bomb
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dive Bomb
    • Actions
      • -------- ------------------------------------------------------------------------- --------
      • -------- ------ This last function stops the expiration. ------ --------
      • -------- The first variable recycles the Soar_Index. --------
      • -------- ------------------------------------------------------------------------- --------
      • Set Soar_Index = (Soar_Index - 1)
      • Set DB_Index = (DB_Index + 1)
      • Set DB_Point[DB_Index] = (Target point of ability being cast)
      • Unit - Move (Triggering unit) instantly to DB_Point[DB_Index]
      • Unit Group - Pick every unit in (Units within 250.00 of DB_Point[DB_Index] matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 100.00 damage of attack type Siege and damage type Normal
      • Unit - Remove Metamorphosis buff from (Triggering unit)
      • Special Effect - Create a special effect at DB_Point[DB_Index] using war3mapImported\NewDirtEXNofire.mdx
      • Animation - Change (Triggering unit) flying height to 0.00 at 0.00
      • Animation - Change (Triggering unit) flying height to 100.00 at 0.00
      • Unit - Remove Dive Bomb from (Triggering unit)
      • Player - Enable Soar for (Owner of (Triggering unit))
      • For each (Integer A) from 1 to Soar_Index, do (Actions)
        • Loop - Actions
          • Set ExpirationBoolean[(Integer A)] = False
ive never had problems with integer A before but if i have to ill just change it using my Global i already set up in previous spells, and even if expirationformula was arrayed it wouldnt have effect on how i tested it.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
You better divide trigger, because now it hurts eyes.

Where do you set this FW_Index? I can't find, and if you dont no dummies are created.
Don't use 'And - All (Conditions) are true' in loop trigger since 'If (All Conditions are True) then do (Then Actions) else do (Else Actions)' does it by default. Loop should be somelike:
  • Time - Every 0.10 seconds of game time
  • Conditions
  • Actions
    • For each SI from 1 to Soar_Index, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • HeightBoolean[SI] Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current flying height of Soar_Unit[SI]) Less than 500.00
            • Then - Actions
              • Animation - Change Soar_Unit[SI] flying height to ((Current flying height of Soar_Unit[SI]) + 50.00) at 0.00
            • Else - Actions
              • Set HeightBoolean[SI] = False
              • Set ExpirationBoolean[Soar_Index] = True
        • Else - Actions
Do similar thing about other loop trigger, but I dont see here ANY part that would prevent trigger from running when therre are no instances.
Null array unit varaibles when instance is finished.
Btw, whats 'Set ExpirationBoolean[Soar_Index] = True'?

Last trigger leaks location, use:
  • Custom script: call RemoveLocation(udg_DB_Point[udg_DB_Index])
At the end of that function. You do not add Crown form to units, therefore if they cant fly by default you won't be able to change thier height.
Change the indexing, its inefficient not dynamic and confusing - better make use of Hanky's dynamic indexing or Bribe's unit Indexer.
 
Level 13
Joined
Mar 16, 2008
Messages
941
The entire trigges is fully overcomplicated. Don't split it into two parts.
I don't see it excactly but your problem has to be in the combinations of ExpirationBoolean and SoarExpiration. I recomment just to use ONE trigger with about 0.03 timeout to make it fluent.
And please, don't listen to this dumb rumor that Integer A could bug.
Integer A CAN't bug unless you use waits or start new threads. However, I'm unsure if this is even possible in GUI in a non-senseless way.
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
Well i fixed it and everything you guys were saying was wrrrrooonngg. This is what i needed in the trigger Dive Bomb
  • For each (Integer A) from 1 to Soar_Index, do (Actions)
    • Loop - Actions
      • Set ExpirationBoolean[(Integer A)] = False
      • Set Soar_Expiration[(Integer A)] = Soar_ExpirationFormula
1 little Set variable fixed everything! yaaay....
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Nope mate, truth hurts but this thats it: You did everything wrong, from the begining. Me, Pharaoh_, Justify and mckill2099 tried to help you but I see you do not want help at all.

You are running 4 triggers where there is a lot of unneeded code, functions can be cut in half, triggers leak and you are using poor, inefficient, old indexing system - yeah, I forgot to tell that it's not smooth and lagless so expect lags in later moments.

However, grats on finding source of the problem =)
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
I knew there was a leak, i wanted it to work first... then i was going to fix the leak, and i did take your advice with the stacked if then else instead of the And conditions, But every variable has a purpose so i dont see how any of that can be reduced by half.

And what u said about nothing stopping it from running, the HeightBoolean turning to false stops it from running a full trigger... And i cant turn off the trigger when its done or it wont be MUI
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
this is what i did

  • Spell Check
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Soar for (Picked unit)) Greater than 0
            • Then - Actions
              • Trigger - Turn on Soar <gen>
              • Trigger - Turn on Soar Expiration <gen>
              • Trigger - Turn on Soar Height <gen>
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Feather Weight for (Picked unit)) Greater than 0
            • Then - Actions
              • Trigger - Turn on FW Dummy Movement <gen>
            • Else - Actions
i didnt add the turn off part, but this is basicly how i interpreted what u said...
 
Status
Not open for further replies.
Top