1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  4. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] How to speed up hashtables. Possible?

Discussion in 'Triggers & Scripts' started by TKF, Feb 23, 2013.

  1. TKF

    TKF

    Joined:
    Nov 29, 2006
    Messages:
    1,237
    Resources:
    5
    Maps:
    5
    Resources:
    5
    I have a problem where the hashtables struggle to load several values in one instant, like loading 60-70 values. It causes the quite significant spike in game performance and its noticeable in multiplayer, and not very noticeable in singleplayer.

    Is it a way to make it lagg less? I'm not sure the wc3optimizer anti bj's the GUI hashtables.
     
  2. Xonok

    Xonok

    Joined:
    Mar 27, 2012
    Messages:
    3,042
    Resources:
    8
    Spells:
    3
    Tutorials:
    5
    Resources:
    8
    Probably the best cure is just loading less values at a time.
    What are you loading in such amounts anyway?
     
  3. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,718
    Resources:
    18
    Maps:
    1
    Spells:
    11
    Tutorials:
    6
    Resources:
    18
    Use custom scripts to store stuff
    Use a variable for each key
     
  4. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,181
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    Post the trigger.
     
  5. TKF

    TKF

    Joined:
    Nov 29, 2006
    Messages:
    1,237
    Resources:
    5
    Maps:
    5
    Resources:
    5
    I'm using custom scripts integer values instead of handles since since handles are crap.


    The trigger breaks the text limit of single post, its a huge one, So I can post the shield one instead. All I can say is that its using GUI hashtables and using integer values instead of handles of any kind.

    But I cannot located the scripts after optimizing the map, so I'm not sure they are converted to natives. So I don't know if optimizer to remove the bj's.

    • Missile Shield Impact
      • Events
        • Unit - A unit Dies
      • Conditions
        • Or - Any (Conditions) are true
          • Conditions
            • ((Dying unit) is An Ancient) Equal to True
            • (Unit-type of (Dying unit)) Equal to Small Laser Beam (Space)
        • (Unit-type of (Dying unit)) Not equal to Cargo Drone (Space)
        • (Unit-type of (Killing unit)) Equal to Battlecruiser Locator 2
      • Actions
        • Set Temp_Point = (Position of (Killing unit))
        • Set Temp_Point2 = (Position of (Dying unit))
        • Set MissileHitCruiserTemp = (Triggering unit)
        • Custom script: set udg_IDMissile = GetUnitTypeId(GetTriggerUnit())
        • -------- Carbonite Deflector and Shield Color --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Killing unit) Equal to CruiserLocator[1]
            • CarboniteDeflectOn1 Equal to True
            • (Remaining time for ShieldEffectTimer[0]) Equal to 0.00
          • Then - Actions
            • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 11 (Dark Green) at Temp_Point2 facing ((Facing of (Triggering unit)) - 180.00) degrees
            • Sound - Play Reflection <gen> at 100.00% volume, attached to Battlecruiser Unit 0001 <gen>
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Unit-type of (Triggering unit)) Equal to Yamato Blast (Space)
              • Then - Actions
                • Set Cruiser1StoredPower = 5000
                • Set Cruiser1Shield = -5.00
              • Else - Actions
            • Unit - Add a ((Load 8 of IDMissile from HashDamageData) x 0.50) second Generic expiration timer to (Last created unit)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Load 6 of IDMissile from HashDamageData) Equal to True
              • Then - Actions
                • Set CoreStabilityPoints[1] = (CoreStabilityPoints[1] - 35)
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Or - Any (Conditions) are true
                  • Conditions
                    • (Unit-type of (Triggering unit)) Equal to Opposer Proximity Mine (Space)
                    • (Unit-type of (Triggering unit)) Equal to Devastator Proximity Mine (Space)
                    • (Unit-type of (Triggering unit)) Equal to Obliterator Proximity Mine (Space)
              • Then - Actions
                • Unit - Add classification of An Ancient to (Last created unit)
                • Unit - Add Mine Collision Size Small to (Last created unit)
                • Unit - Remove classification of Undead from (Last created unit)
              • Else - Actions
            • Unit Group - Add (Last created unit) to MoveMissile
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Remaining time for ShieldEffectTimer[0]) Equal to 0.00
              • Then - Actions
                • Unit - Create 1 Shield Effect for Neutral Passive at Temp_Point facing (Facing of Battlecruiser Unit 0001 <gen>) degrees
                • Animation - Change (Last created unit)'s vertex coloring to (1.00%, 100.00%, 1.00%) with 0.00% transparency
              • Else - Actions
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Remaining time for ShieldEffectTimer[0]) Equal to 0.00
                • (Killing unit) Equal to CruiserLocator[1]
                • CereberusShieldOn[0] Equal to True
              • Then - Actions
                • Unit - Create 1 Shield Effect 2 for Neutral Passive at Temp_Point facing (Facing of Battlecruiser Unit 0001 <gen>) degrees
                • Set CoreStabilityPoints[1] = (CoreStabilityPoints[1] - 5)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • CereberusCoreDrain[0] Equal to True
                    • Cruiser1StoredPower Less than 10000
                  • Then - Actions
                    • Animation - Change (Last created unit)'s vertex coloring to (100.00%, 10.00%, 20.00%) with 0.00% transparency
                  • Else - Actions
              • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Killing unit) Equal to CruiserLocator[1]
                    • (Remaining time for ShieldEffectTimer[0]) Equal to 0.00
                  • Then - Actions
                    • Unit - Create 1 Shield Effect for Neutral Passive at Temp_Point facing (Facing of Battlecruiser Unit 0001 <gen>) degrees
                  • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Killing unit) Equal to CruiserLocator[2]
            • CarboniteDeflectOn2 Equal to True
            • (Remaining time for ShieldEffectTimer[1]) Equal to 0.00
          • Then - Actions
            • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 12 (Brown) at Temp_Point2 facing ((Facing of (Triggering unit)) - 180.00) degrees
            • Sound - Play Reflection <gen> at 100.00% volume, attached to Battlecruiser Unit 0092 <gen>
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Unit-type of (Triggering unit)) Equal to Yamato Blast (Space)
              • Then - Actions
                • Set Cruiser2Shield = -5.00
                • Set Cruiser2StoredPower = 5000
              • Else - Actions
            • Unit - Add a ((Load 8 of IDMissile from HashDamageData) x 0.50) second Generic expiration timer to (Last created unit)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Load 6 of IDMissile from HashDamageData) Equal to True
              • Then - Actions
                • Set CoreStabilityPoints[2] = (CoreStabilityPoints[2] - 35)
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Or - Any (Conditions) are true
                  • Conditions
                    • (Unit-type of (Triggering unit)) Equal to Opposer Proximity Mine (Space)
                    • (Unit-type of (Triggering unit)) Equal to Devastator Proximity Mine (Space)
                    • (Unit-type of (Triggering unit)) Equal to Obliterator Proximity Mine (Space)
              • Then - Actions
                • Unit - Add classification of An Ancient to (Last created unit)
                • Unit - Add Mine Collision Size Small to (Last created unit)
                • Unit - Remove classification of Undead from (Last created unit)
              • Else - Actions
            • Unit Group - Add (Last created unit) to MoveMissile
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Remaining time for ShieldEffectTimer[1]) Equal to 0.00
              • Then - Actions
                • Unit - Create 1 Shield Effect for Neutral Passive at Temp_Point facing (Facing of Battlecruiser Unit 0001 <gen>) degrees
                • Animation - Change (Last created unit)'s vertex coloring to (1.00%, 100.00%, 1.00%) with 0.00% transparency
              • Else - Actions
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Killing unit) Equal to CruiserLocator[2]
                • CereberusShieldOn[1] Equal to True
                • (Remaining time for ShieldEffectTimer[1]) Equal to 0.00
              • Then - Actions
                • Set CoreStabilityPoints[2] = (CoreStabilityPoints[2] - 5)
                • Unit - Create 1 Shield Effect 2 for Neutral Passive at Temp_Point facing (Facing of Battlecruiser Unit 0001 <gen>) degrees
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • CereberusCoreDrain[1] Equal to True
                    • Cruiser2StoredPower Less than 10000
                  • Then - Actions
                    • Animation - Change (Last created unit)'s vertex coloring to (100.00%, 10.00%, 20.00%) with 0.00% transparency
                  • Else - Actions
              • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Killing unit) Equal to CruiserLocator[2]
                    • (Remaining time for ShieldEffectTimer[1]) Equal to 0.00
                  • Then - Actions
                    • Unit - Create 1 Shield Effect for Neutral Passive at Temp_Point facing (Facing of Battlecruiser Unit 0001 <gen>) degrees
                  • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Or - Any (Conditions) are true
              • Conditions
                • And - All (Conditions) are true
                  • Conditions
                    • (Killing unit) Equal to CruiserLocator[1]
                    • (Remaining time for ShieldEffectTimer[0]) Equal to 0.00
                • And - All (Conditions) are true
                  • Conditions
                    • (Killing unit) Equal to CruiserLocator[2]
                    • (Remaining time for ShieldEffectTimer[1]) Equal to 0.00
          • Then - Actions
            • Unit - Set (Last created unit) movement speed to (Current movement speed of Battlecruiser Unit 0001 <gen>)
            • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Killing unit) Equal to CruiserLocator[1]
              • Then - Actions
                • Countdown Timer - Start ShieldEffectTimer[0] as a One-shot timer that will expire in 1.50 seconds
              • Else - Actions
                • Countdown Timer - Start ShieldEffectTimer[1] as a One-shot timer that will expire in 1.50 seconds
          • Else - Actions
        • Unit - Create 1 Low Lightning Effect for Neutral Passive at Temp_Point2 facing Default building facing degrees
        • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
        • Custom script: call RemoveLocation(udg_Temp_Point)
        • Custom script: call RemoveLocation(udg_Temp_Point2)
        • -------- Hashtable Damage Data --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Killing unit) Equal to CruiserLocator[1]
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Or - Any (Conditions) are true
                  • Conditions
                    • (Player 1 (Red) is in Admins) Equal to True
                    • (Player 2 (Blue) is in Admins) Equal to True
              • Then - Actions
                • Game - Display to Admins the text: (Shield Damage applied + (String(IDMissile)))
                • Game - Display to Admins the text: (Damage applied + (String((((Load 0 of IDMissile from HashDamageData) x ShieldResistance[0]) + (Load 9 of IDMissile from HashDamageData)))))
              • Else - Actions
            • -------- Usually where you set a real value, use the "Hashtable - Load Real Value (hashtable)" --------
            • Set Cruiser1Shield = (Cruiser1Shield - ((Load 0 of IDMissile from HashDamageData) x ShieldResistance[0]))
            • -------- Usually where you set a integer value, use the "Hashtable - Load Integer Value (hashtable)" --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Load 2 of IDMissile from HashDamageData) Greater than 0
              • Then - Actions
                • Set CoreDamageLeach[1] = (CoreDamageLeach[1] + ((Load 2 of IDMissile from HashDamageData) / 2))
              • Else - Actions
            • -------- Against shields it receives only 50% core damage --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Load 3 of IDMissile from HashDamageData) Greater than 0
              • Then - Actions
                • Set CoreStabilityPoints[1] = (CoreStabilityPoints[1] - ((Load 3 of IDMissile from HashDamageData) / 2))
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Load 4 of IDMissile from HashDamageData) Greater than 0
              • Then - Actions
                • Set Cruiser1StoredPower = (Cruiser1StoredPower - (Load 4 of IDMissile from HashDamageData))
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Load 6 of IDMissile from HashDamageData) Equal to True
              • Then - Actions
                • Set Cruiser1Shield = (Cruiser1Shield - (((Load 0 of IDMissile from HashDamageData) x (0.20 x (Real((Current research level of Cruiser Laser Upgrade for (Owner of (Triggering unit))))))) x ShieldResistance[0]))
              • Else - Actions
            • Set Cruiser1Shield = (Cruiser1Shield - (Load 9 of IDMissile from HashDamageData))
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • CereberusShieldOn[0] Equal to True
              • Then - Actions
                • Set Cruiser1Shield = (Cruiser1Shield - (((Load 9 of IDMissile from HashDamageData) x 0.50) + 0.05))
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Load 10 of IDMissile from HashDamageData) Greater than 0
              • Then - Actions
                • Set MiningLaserNoShield[1] = (MiningLaserNoShield[1] + (Load 10 of IDMissile from HashDamageData))
              • Else - Actions
            • Sound - Play ManaFlareStrike <gen> at 100.00% volume, attached to Battlecruiser Unit 0001 <gen>
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Killing unit) Equal to CruiserLocator[2]
              • Then - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Or - Any (Conditions) are true
                      • Conditions
                        • (Player 1 (Red) is in Admins) Equal to True
                        • (Player 2 (Blue) is in Admins) Equal to True
                  • Then - Actions
                    • Game - Display to Admins the text: (Shield Damage applied + (String(IDMissile)))
                    • Game - Display to Admins the text: (Damage applied + (String((((Load 0 of IDMissile from HashDamageData) x ShieldResistance[1]) + (Load 9 of IDMissile from HashDamageData)))))
                  • Else - Actions
                • Set Cruiser2Shield = (Cruiser2Shield - ((Load 0 of IDMissile from HashDamageData) x ShieldResistance[1]))
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Load 2 of IDMissile from HashDamageData) Greater than 0
                  • Then - Actions
                    • Set CoreDamageLeach[2] = (CoreDamageLeach[2] + ((Load 2 of IDMissile from HashDamageData) / 2))
                  • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Load 3 of IDMissile from HashDamageData) Greater than 0
                  • Then - Actions
                    • Set CoreStabilityPoints[2] = (CoreStabilityPoints[2] - ((Load 3 of IDMissile from HashDamageData) / 2))
                  • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Load 4 of IDMissile from HashDamageData) Greater than 0
                  • Then - Actions
                    • Set Cruiser2StoredPower = (Cruiser2StoredPower - (Load 4 of IDMissile from HashDamageData))
                  • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Load 6 of IDMissile from HashDamageData) Equal to True
                  • Then - Actions
                    • Set Cruiser2Shield = (Cruiser2Shield - (((Load 0 of IDMissile from HashDamageData) x (0.20 x (Real((Current research level of Cruiser Laser Upgrade for (Owner of (Triggering unit))))))) x ShieldResistance[0]))
                  • Else - Actions
                • Set Cruiser2Shield = (Cruiser2Shield - (Load 9 of IDMissile from HashDamageData))
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • CereberusShieldOn[1] Equal to True
                  • Then - Actions
                    • Set Cruiser2Shield = (Cruiser2Shield - (((Load 9 of IDMissile from HashDamageData) x 0.50) + 0.05))
                  • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Load 10 of IDMissile from HashDamageData) Greater than 0
                  • Then - Actions
                    • Set MiningLaserNoShield[2] = (MiningLaserNoShield[2] + (Load 10 of IDMissile from HashDamageData))
                  • Else - Actions
                • Sound - Play ManaFlareStrike <gen> at 100.00% volume, attached to Battlecruiser Unit 0092 <gen>
              • Else - Actions
        • -------- Special Missile Events --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Triggering unit)) Equal to Yamato Blast (Space)
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Killing unit) Equal to CruiserLocator[1]
              • Then - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Custom value of (Triggering unit)) Greater than 0
                  • Then - Actions
                    • Set Cruiser1Shield = (Cruiser1Shield + 70.00)
                    • Set CoreStabilityPoints[1] = (CoreStabilityPoints[1] + 82)
                  • Else - Actions
              • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Custom value of (Triggering unit)) Greater than 0
                  • Then - Actions
                    • Set CoreStabilityPoints[2] = (CoreStabilityPoints[2] + 82)
                    • Set Cruiser2Shield = (Cruiser2Shield + 70.00)
                  • Else - Actions
                    • Set CoreStabilityPoints[2] = (CoreStabilityPoints[2] - 100)
                    • Set Cruiser2Shield = (Cruiser2Shield - 140.00)
                    • Sound - Play ManaFlareStrike <gen> at 100.00% volume, attached to Battlecruiser Unit 0092 <gen>
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • Cruiser2Shield Less than 180.00
                      • Then - Actions
                        • Set Cruiser2StoredPower = (Cruiser2StoredPower - 15000)
                      • Else - Actions
                        • Set Cruiser2StoredPower = (Cruiser2StoredPower - 7500)
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • Cruiser2StoredPower Less than -4000
                      • Then - Actions
                        • Set Cruiser2StoredPower = -4000
                      • Else - Actions
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Dying unit)) Equal to Opposer Proximity Mine (Space)
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Killing unit) Equal to CruiserLocator[1]
              • Then - Actions
                • Set Cruiser1EnginePower = (Cruiser1EnginePower - 25)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Cruiser1EnginePower Less than 0
                  • Then - Actions
                    • Set Cruiser1EnginePower = 0
                  • Else - Actions
              • Else - Actions
                • Set Cruiser2EnginePower = (Cruiser2EnginePower - 25)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Cruiser2EnginePower Less than 0
                  • Then - Actions
                    • Set Cruiser2EnginePower = 0
                  • Else - Actions
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Dying unit)) Equal to Photon Torpedo (Space)
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Killing unit) Equal to CruiserLocator[1]
              • Then - Actions
                • Set CoreDamageLeach[1] = (CoreDamageLeach[1] + 8)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Custom value of (Triggering unit)) Equal to 1
                  • Then - Actions
                    • Set Cruiser1Shield = (Cruiser1Shield - (13.00 x ShieldResistance[0]))
                    • Set Cruiser1StoredPower = (Cruiser1StoredPower - 2000)
                  • Else - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Custom value of (Triggering unit)) Equal to 2
                      • Then - Actions
                        • Set CoreDamageLeach[1] = (CoreDamageLeach[1] + 48)
                      • Else - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • (Custom value of (Triggering unit)) Equal to 0
                          • Then - Actions
                            • Set Cruiser1Shield = (Cruiser1Shield - (16.00 x ShieldResistance[0]))
                            • Set Cruiser1Hull = (Cruiser1Hull - 2.00)
                            • Set MiningLaserNoShield[1] = (MiningLaserNoShield[1] + 6)
                          • Else - Actions
                • Sound - Play ManaFlareStrike <gen> at 100.00% volume, attached to Battlecruiser Unit 0001 <gen>
              • Else - Actions
                • Set CoreDamageLeach[2] = (CoreDamageLeach[2] + 8)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Custom value of (Triggering unit)) Equal to 1
                  • Then - Actions
                    • Set Cruiser2Shield = (Cruiser2Shield - (13.00 x ShieldResistance[1]))
                    • Set Cruiser2StoredPower = (Cruiser2StoredPower - 2000)
                  • Else - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Custom value of (Triggering unit)) Equal to 2
                      • Then - Actions
                        • Set CoreDamageLeach[2] = (CoreDamageLeach[2] + 48)
                      • Else - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • (Custom value of (Triggering unit)) Equal to 0
                          • Then - Actions
                            • Set Cruiser2Shield = (Cruiser2Shield - (16.00 x ShieldResistance[1]))
                            • Set Cruiser2Hull = (Cruiser2Hull - 2.00)
                            • Set MiningLaserNoShield[2] = (MiningLaserNoShield[2] + 6)
                          • Else - Actions
                • Sound - Play ManaFlareStrike <gen> at 100.00% volume, attached to Battlecruiser Unit 0092 <gen>
          • Else - Actions
        • -------- Power Drain limit --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Killing unit) Equal to CruiserLocator[1]
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Cruiser1StoredPower Less than -20000
              • Then - Actions
                • Set Cruiser1StoredPower = -20000
              • Else - Actions
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Cruiser2StoredPower Less than -20000
              • Then - Actions
                • Set Cruiser2StoredPower = -20000
              • Else - Actions
        • -------- Checks when shields fails --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ShieldOn[1] Equal to True
            • Or - Any (Conditions) are true
              • Conditions
                • Cruiser1Shield Less than or equal to 0.00
                • MiningLaserNoShield[1] Greater than 1
          • Then - Actions
            • Game - Display to Battlecruiser1 the text: |cffFF0202Shield Of...
            • Game - Display to Battlecruiser1 the text: |cffffff02Yellow Al...
            • Player Group - Pick every player in Battlecruiser1 and do (Actions)
              • Loop - Actions
                • Set localplayer = (Picked player)
                • Custom script: if udg_localplayer == GetLocalPlayer() then
                • Sound - Play alarm <gen>
                • Custom script: endif
            • Unit - Remove Shield Protection from CruiserLocator[1]
            • Set ShieldOn[1] = False
            • For each (Integer A) from 3 to 8, do (Actions)
              • Loop - Actions
                • Unit - Add Hull Impact Small to Battlecruiser1Hardpoints[(Integer A)]
            • Unit - Add Hull Impact Tiny to Battlecruiser1Hardpoints[1]
            • Unit - Add Hull Impact Tiny to Battlecruiser1Hardpoints[2]
            • Unit - Add Hull Impact Large to Battlecruiser1Hardpoints[4]
            • Unit - Add Hull Impact Huge to Battlecruiser1Hardpoints[5]
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ShieldOn[2] Equal to True
            • Or - Any (Conditions) are true
              • Conditions
                • Cruiser2Shield Less than or equal to 0.00
                • MiningLaserNoShield[2] Greater than 1
          • Then - Actions
            • Game - Display to Battlecruiser2 the text: |cffFF0202Shield Of...
            • Game - Display to Battlecruiser2 the text: |cffffff02Yellow Al...
            • Player Group - Pick every player in Battlecruiser2 and do (Actions)
              • Loop - Actions
                • Set localplayer = (Picked player)
                • Custom script: if udg_localplayer == GetLocalPlayer() then
                • Sound - Play alarm <gen>
                • Custom script: endif
            • Unit - Remove Shield Protection from CruiserLocator[2]
            • Set ShieldOn[2] = False
            • For each (Integer A) from 3 to 8, do (Actions)
              • Loop - Actions
                • Unit - Add Hull Impact Small to Battlecruiser2Hardpoints[(Integer A)]
            • Unit - Add Hull Impact Tiny to Battlecruiser2Hardpoints[1]
            • Unit - Add Hull Impact Tiny to Battlecruiser2Hardpoints[2]
            • Unit - Add Hull Impact Large to Battlecruiser2Hardpoints[4]
            • Unit - Add Hull Impact Huge to Battlecruiser2Hardpoints[5]
          • Else - Actions


    Well, it maybe only loads 10 about values here and more in hull impact trigger.


    The lagg is either related to hashtables or shield effects. But the hull impact is a bit worse. (It was to long to post it here)
     
  6. SA Dashie

    SA Dashie

    Joined:
    Apr 3, 2010
    Messages:
    1,463
    Resources:
    6
    Skins:
    2
    Maps:
    2
    Spells:
    1
    Template:
    1
    Resources:
    6
    I would suggest maybe even learning some basic jass to dull the lag down.
    Triggering so many functions at once is obviously going to cause lag. Especially with no waits in use.
    The use of GUI with 'if then else' function differs from what they disposed to look like in actual Jass.
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • False Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: False is true
        • Else - Actions
          • Game - Display to (All players) the text: False not true
    When this GUI trigger is converted to jass it looks like this
    Code (vJASS):
    function Trig_Melee_Initialization_Func001C takes nothing returns boolean
        if ( not ( false == true ) ) then
            return false
        endif
        return true
    endfunction

    function Trig_Melee_Initialization_Actions takes nothing returns nothing
        if ( Trig_Melee_Initialization_Func001C() ) then
            call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_002" )
        else
            call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_001" )
        endif
    endfunction
    When if you learn to use some basic jass your code could potentiality drag out a lot of trash.
    Code (vJASS):
    function IfElseTest takes nothing returns nothing
        if false == true then
            call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "False is true")
        else
            call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "False not true")
        endif
    endfunction
    Your code can easily be halved!
    ----

    Not only that this function would help but you will also be able to manipulate the use of natives, local variable use and optimization of all sorts of other code a lot more easily.
    ----

    You also appear to be repeating some code in the first two if then else functions. Learning to loop variables to compress this code should be a plus!
     
  7. Ender

    Ender

    Joined:
    Jan 28, 2012
    Messages:
    208
    Resources:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    2
    you should store killing unit into a variable.
    Edit: it looks like you can nest the last if in the second to last one else.
    Edit2: you can also doe the same for the first and second ifs.
    Edit3: you can put nest the three special missile ifs inside of each other
    Edit4: you should also store triggering unit in a variable
     
  8. TKF

    TKF

    Joined:
    Nov 29, 2006
    Messages:
    1,237
    Resources:
    5
    Maps:
    5
    Resources:
    5
    Well, I get it with 1 condition, but what if there is 2 or 3 conditions? How should I shorten that?
     
  9. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,528
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    here is how u return multiple conditions. there r 3 examples one uses and for all conditions. the other uses all ors which returns any of the 3 for true. the other returns one tht can be and two tht must be.

    Code (vJASS):

    function conditions1 takes nothing returns boolean
        return condition1 == true and condition2 == true and condition3 == true
    endfunction

    function conditions2 takes nothing returns boolean
        return condition1 == true or condition2 == true or condition3 == true
    endfunction

    function conditions3 takes nothing returns boolean
        return condition1 == true or (condition2 == true and condition3 == true)
    endfunction
     
     
  10. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,181
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    Code (vJASS):

    function conditions1 takes nothing returns boolean
        return condition1 and condition2 and condition3
    endfunction
     
     
  11. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,528
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    ya i always like having the == true in there it doesnt slow it down does it ?
     
  12. TKF

    TKF

    Joined:
    Nov 29, 2006
    Messages:
    1,237
    Resources:
    5
    Maps:
    5
    Resources:
    5
    So, I can do condition with 2 ands between the ore like this for example?

    Cond1 and Cond2 or Cond 3 and Cond 4

    if ( GetKillingUnit() == udg_CruiserLocator[1] ) and ( TimerGetRemaining(udg_ShieldEffectTimer[0]) == 0.00 ) or 
    ( GetKillingUnit() == udg_CruiserLocator[2] ) and ( TimerGetRemaining(udg_ShieldEffectTimer[1]) == 0.00 ) then


    Code (vJASS):
    if ( GetKillingUnit() == udg_CruiserLocator[1] ) and ( TimerGetRemaining(udg_ShieldEffectTimer[0]) == 0.00 ) or ( GetKillingUnit() == udg_CruiserLocator[2] ) and ( TimerGetRemaining(udg_ShieldEffectTimer[1]) == 0.00 ) then
            call SetUnitMoveSpeed( GetLastCreatedUnit(), GetUnitMoveSpeed(gg_unit_h000_0001) )
            call UnitApplyTimedLife( 3.00, 'BTLF', GetLastCreatedUnit() )
            if ( GetKillingUnit() == udg_CruiserLocator[1] ) then
                call StartTimerBJ( udg_ShieldEffectTimer[0], false, 1.50 )
            else
                call StartTimerBJ( udg_ShieldEffectTimer[1], false, 1.50 )
            endif
        else
        endif
     
  13. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,528
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    yes tht is right

    edit: u should look at the jass learning tutorials its really not tht hard. i suggest u get jngp if u dont have it already it will help w taking out all the bj functions and replacing them w natives.