• 🏆 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] How to speed up hashtables. Possible?

Status
Not open for further replies.

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
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.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
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)
 
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
JASS:
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.
JASS:
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!
 
  • Like
Reactions: TKF
Level 7
Joined
Jan 28, 2012
Messages
266
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
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
When if you learn to use some basic jass your code could potentiality drag out a lot of trash.
JASS:
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
Well, I get it with 1 condition, but what if there is 2 or 3 conditions? How should I shorten that?
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Well, I get it with 1 condition, but what if there is 2 or 3 conditions? How should I shorten that?

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.

JASS:
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
 
  • Like
Reactions: TKF

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
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

JASS:
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
 
Status
Not open for further replies.
Top