Will converting this remove the lag?

Zackreaver

New Member
Reaction score
2
Hello there, on my map I've had this one particular trigger that has been causing a repeating pause in the game, I'm absolutely certain its this trigger because I have tested it out with the trigger shut off.

At any rate, I've checked the trigger for leaks, its clean from what the leak checker says and yet everytime the trigger goes off, which is a periodic 1 second, theres a tiny pause in the gameplay. I'm not sure if this is avoidable but I want to make sure, so here is my question:

Will converting the following trigger to JASS format have any impact on the lag its causing? Will using local's and hand made function's remove/lower the pause that I constantly get? If so, where should I focus mainly, and if not what should do, because I need the trigger.

Code:
Periodic 1 Second
    Events
        Time - Every 1.00 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
                -------- Twilight Fortress Immobility --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (In-game time of day) Greater than or equal to 5.99
                        (In-game time of day) Less than or equal to 18.00
                        Or - Any (Conditions) are true
                            Conditions
                                (Unit-type of (Picked unit)) Equal to Twilight Fortress (Zack) "Dark"
                                (Unit-type of (Picked unit)) Equal to Twilight Fortress Landed (Landed)(Zack) "Dark"
                    Then - Actions
                        Unit - Add zDaylight Power Drain  to (Picked unit)
                    Else - Actions
                        Do nothing
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Or - Any (Conditions) are true
                            Conditions
                                (In-game time of day) Less than 5.99
                                (In-game time of day) Greater than 18.00
                        Or - Any (Conditions) are true
                            Conditions
                                (Unit-type of (Picked unit)) Equal to Twilight Fortress (Zack) "Dark"
                                (Unit-type of (Picked unit)) Equal to Twilight Fortress Landed (Landed)(Zack) "Dark"
                    Then - Actions
                        Unit - Remove zDaylight Power Drain  from (Picked unit)
                    Else - Actions
                        Do nothing
                -------- Godfather Upgrade Skill Level --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Picked unit)) Equal to Treant Godfather (Zack) "Nature"
                        (Level of zBonding Ritual 2 (Zack) "Nature" for (Picked unit)) Not equal to 1
                    Then - Actions
                        Unit - Set level of zBonding Ritual 2 (Zack) "Nature" for (Picked unit) to 1
                    Else - Actions
                        Do nothing
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Picked unit)) Equal to Greater Treant Godfather (Zack) "Nature"
                        (Level of zBonding Ritual 2 (Zack) "Nature" for (Picked unit)) Not equal to 2
                    Then - Actions
                        Unit - Set level of zBonding Ritual 2 (Zack) "Nature" for (Picked unit) to 2
                    Else - Actions
                        Do nothing
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Picked unit)) Equal to Ancient Treant Godfather (Zack) "Nature"
                        (Level of zBonding Ritual 2 (Zack) "Nature" for (Picked unit)) Not equal to 3
                    Then - Actions
                        Unit - Set level of zBonding Ritual 2 (Zack) "Nature" for (Picked unit) to 3
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Picked unit)) Equal to God of Nature (Zack) "Nature"
                        (Level of zBonding Ritual 2 (Zack) "Nature" for (Picked unit)) Not equal to 3
                    Then - Actions
                        Unit - Set level of zBonding Ritual 2 (Zack) "Nature" for (Picked unit) to 3
                    Else - Actions
                        Do nothing
                -------- Dark Resource Harvest --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) has buff Dark Shroud Invisible ) Equal to True
                    Then - Actions
                        Unit - Add zDark Shroud Invisible Permanent 2  to (Picked unit)
                    Else - Actions
                        Unit - Remove zDark Shroud Invisible Permanent 2  from (Picked unit)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) has buff Dark Shroud ) Equal to True
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Current order of (Picked unit)) Equal to (Order(starfall))
                            Then - Actions
                                Set Temp_Point = (Position of (Picked unit))
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (In-game time of day) Greater than or equal to 12.00
                                    Then - Actions
                                        Set Temp_Int = ((Integer((In-game time of day))) - 12)
                                        Set Temp_Int = (Temp_Int + ((Integer(((Max life of (Picked unit)) - (Life of (Picked unit))))) / 30))
                                    Else - Actions
                                        Do nothing
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (In-game time of day) Less than 12.00
                                    Then - Actions
                                        Set Temp_Int = (12 - (Integer((In-game time of day))))
                                        Set Temp_Int = (Temp_Int + ((Integer(((Max life of (Picked unit)) - (Life of (Picked unit))))) / 30))
                                    Else - Actions
                                        Do nothing
                                Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 10.00)
                                Player - Add Temp_Int to (Owner of (Picked unit)) Current gold
                                Floating Text - Create floating text that reads (+ + (String(Temp_Int))) at Temp_Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
                                Floating Text - Hide (Last created floating text) for (All players)
                                Floating Text - Show (Last created floating text) for (Player group((Owner of (Picked unit))))
                                Floating Text - Change (Last created floating text): Disable permanence
                                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                                Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                                Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
                                Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
                                Special Effect - Destroy (Last created special effect)
                                Set Temp_Int = 0
                                Custom script:   call RemoveLocation(udg_Temp_Point)
                            Else - Actions
                                Do nothing
                    Else - Actions
                        Do nothing
                -------- Rain Resource Harvest --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) has buff zRain ) Equal to True
                    Then - 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 (Picked unit)) Equal to Water Well (Zack) "Water"
                                        (Unit-type of (Picked unit)) Equal to Temple of the Sea (Zack) "Water"
                            Then - Actions
                                Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 5.00)
                            Else - Actions
                                Do nothing
                        Player - Add 1 to (Owner of (Picked unit)) Current gold
                        Set Temp_Point = (Position of (Picked unit))
                        Floating Text - Create floating text that reads +1 at Temp_Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
                        Floating Text - Hide (Last created floating text) for (All players)
                        Floating Text - Show (Last created floating text) for (Player group((Owner of (Picked unit))))
                        Floating Text - Change (Last created floating text): Disable permanence
                        Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                        Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                        Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
                        Custom script:   call RemoveLocation(udg_Temp_Point)
                    Else - Actions
                -------- Mist Form --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) has buff Mist Form ) Equal to True
                    Then - Actions
                        Unit - Add Mist Form Evasion to (Picked unit)
                    Else - Actions
                        Unit - Remove Mist Form Evasion from (Picked unit)
                -------- Fire Resource Harvest --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Picked unit)) Equal to Fire (Zack) "Fire"
                    Then - Actions
                        Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 10.00)
                        Set Temp_Point = (Position of (Picked unit))
                        Floating Text - Create floating text that reads +1 at Temp_Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
                        Floating Text - Hide (Last created floating text) for (All players)
                        Floating Text - Show (Last created floating text) for (Player group((Owner of (Picked unit))))
                        Floating Text - Change (Last created floating text): Disable permanence
                        Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                        Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                        Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
                        Custom script:   call RemoveLocation(udg_Temp_Point)
                        Player - Add 1 to (Owner of (Picked unit)) Current gold
                        Set Temp_Point2 = (Position of (Picked unit))
                        Destructible - Pick every destructible within 290.00 of Temp_Point2 and do (Actions)
                            Loop - Actions
                                Set Temp_Point3 = (Position of (Picked destructible))
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Distance between Temp_Point2 and Temp_Point3) Less than or equal to 290.00
                                        ((Picked destructible) is alive) Equal to True
                                        (Destructible-type of (Picked destructible)) Not equal to Rock Chunks
                                    Then - Actions
                                        Set Temp_Point = (Position of (Picked destructible))
                                        Special Effect - Create a special effect at Temp_Point using Abilities\Weapons\DemolisherFireMissile\DemolisherFireMissile.mdl
                                        Special Effect - Destroy (Last created special effect)
                                        Destructible - Set life of (Picked destructible) to ((Current life of (Picked destructible)) - 5.00)
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Destructible-type of (Picked destructible)) Equal to Coal
                                            Then - Actions
                                                Player - Add 2 to (Owner of (Picked unit)) Current gold
                                                Floating Text - Create floating text that reads +2 at Temp_Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
                                                Floating Text - Hide (Last created floating text) for (All players)
                                                Floating Text - Show (Last created floating text) for (Player group((Owner of (Picked unit))))
                                                Floating Text - Change (Last created floating text): Disable permanence
                                                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                                                Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                                                Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
                                            Else - Actions
                                                Player - Add 1 to (Owner of (Picked unit)) Current gold
                                                Floating Text - Create floating text that reads +1 at Temp_Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
                                                Floating Text - Hide (Last created floating text) for (All players)
                                                Floating Text - Show (Last created floating text) for (Player group((Owner of (Picked unit))))
                                                Floating Text - Change (Last created floating text): Disable permanence
                                                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                                                Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                                                Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
                                        Custom script:   call RemoveLocation(udg_Temp_Point)
                                    Else - Actions
                                        Do nothing
                                Custom script:   call RemoveLocation(udg_Temp_Point3)
                        Set TempUnit = (Picked unit)
                        Custom script:   set bj_wantDestroyGroup = true
                        Unit Group - Pick every unit in (Units within 290.00 of Temp_Point2) and do (Actions)
                            Loop - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Picked unit) is A structure) Equal to True
                                        (Unit-type of (Picked unit)) Not equal to Shadow Wall (Zack) "Dark"
                                        ((Picked unit) is alive) Equal to True
                                        ((Picked unit) belongs to an enemy of (Owner of TempUnit)) Equal to True
                                    Then - Actions
                                        Set Temp_Point = (Position of (Picked unit))
                                        Special Effect - Create a special effect at Temp_Point using Abilities\Weapons\DemolisherFireMissile\DemolisherFireMissile.mdl
                                        Special Effect - Destroy (Last created special effect)
                                        Unit - Cause TempUnit to damage (Picked unit), dealing 20.00 damage of attack type Siege and damage type Fire
                                        Player - Add 3 to (Owner of TempUnit) Current gold
                                        Floating Text - Create floating text that reads +3 at Temp_Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
                                        Floating Text - Hide (Last created floating text) for (All players)
                                        Floating Text - Show (Last created floating text) for (Player group((Owner of TempUnit)))
                                        Floating Text - Change (Last created floating text): Disable permanence
                                        Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                                        Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                                        Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
                                        Custom script:   call RemoveLocation(udg_Temp_Point)
                                    Else - Actions
                                        Do nothing
                        Set TempUnit = No unit
                        Custom script:   call RemoveLocation(udg_Temp_Point2)
                    Else - Actions
                        Do nothing
                -------- Trap Trigger --------
                -------- Motion Trigger --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Picked unit)) Equal to Motion Trigger (Zack) "Dark"
                    Then - Actions
                        Set Temp_Int = (Temp_Int + 100)
                        Set Temp_Point = (Position of (Picked unit))
                        Set TempUnit2 = (Picked unit)
                        -------- Are the nearby units enemies? --------
                        Custom script:   set bj_wantDestroyGroup = true
                        Unit Group - Pick every unit in (Units within 400.00 of Temp_Point) and do (Actions)
                            Loop - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Picked unit) belongs to an enemy of (Owner of TempUnit2)) Equal to True
                                        ((Picked unit) is alive) Equal to True
                                    Then - Actions
                                        Set TempUnit = (Picked unit)
                                        -------- Explosive Trap --------
                                        Custom script:   set bj_wantDestroyGroup = true
                                        Unit Group - Pick every unit in (Units within 400.00 of Temp_Point) and do (Actions)
                                            Loop - Actions
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        ((Picked unit) is alive) Equal to True
                                                        (Unit-type of (Picked unit)) Equal to Explosive Trap (Zack) "Dark"
                                                        (Owner of (Picked unit)) Equal to (Owner of TempUnit2)
                                                        (Percentage life of (Picked unit)) Greater than or equal to 100.00
                                                    Then - Actions
                                                        Set TrapBool = True
                                                        Set Temp_Point2 = (Position of (Picked unit))
                                                        Special Effect - Create a special effect at Temp_Point2 using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
                                                        Special Effect - Destroy (Last created special effect)
                                                        Set Temp_Int = (Temp_Int + 135)
                                                        Unit - Kill (Picked unit)
                                                        Unit - Create 1 Caster for (Owner of TempUnit2) at Temp_Point2 facing Default building facing degrees
                                                        Unit - Add zExplosive Trap  to (Last created unit)
                                                        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                                                        Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
                                                        Custom script:   call RemoveLocation(udg_Temp_Point2)
                                                    Else - Actions
                                                        Do nothing
                                        -------- Magic Distortion Trap --------
                                        Custom script:   set bj_wantDestroyGroup = true
                                        Unit Group - Pick every unit in (Units within 400.00 of Temp_Point) and do (Actions)
                                            Loop - Actions
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        ((Picked unit) is alive) Equal to True
                                                        (Unit-type of (Picked unit)) Equal to Magic Distortion Trap (Zack) "Dark"
                                                        (Owner of (Picked unit)) Equal to (Owner of TempUnit2)
                                                        (Percentage life of (Picked unit)) Greater than or equal to 100.00
                                                    Then - Actions
                                                        Set TrapBool = True
                                                        Set Temp_Point2 = (Position of (Picked unit))
                                                        Set Temp_Int = (Temp_Int + 375)
                                                        Unit - Kill (Picked unit)
                                                        Unit - Create 1 Caster for (Owner of TempUnit2) at Temp_Point2 facing Default building facing degrees
                                                        Unit - Add zMagic Distortion Trap  to (Last created unit)
                                                        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                                                        Unit - Order (Last created unit) to Human Priest - Dispel (Last created unit)
                                                        Custom script:   call RemoveLocation(udg_Temp_Point2)
                                                    Else - Actions
                                                        Do nothing
                                        -------- Black Spider's Web Trap --------
                                        Custom script:   set bj_wantDestroyGroup = true
                                        Unit Group - Pick every unit in (Units within 400.00 of Temp_Point) and do (Actions)
                                            Loop - Actions
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        ((Picked unit) is alive) Equal to True
                                                        (Unit-type of (Picked unit)) Equal to Black Spider's Web Trap (Zack) "Dark"
                                                        (Owner of (Picked unit)) Equal to (Owner of TempUnit2)
                                                        (Percentage life of (Picked unit)) Greater than or equal to 100.00
                                                    Then - Actions
                                                        Set TrapBool = True
                                                        Set Temp_Point2 = (Position of (Picked unit))
                                                        Set Temp_Int = (Temp_Int + 188)
                                                        Unit - Kill (Picked unit)
                                                        Custom script:   set bj_wantDestroyGroup = true
                                                        Unit Group - Pick every unit in (Units within 400.00 of Temp_Point2) and do (Actions)
                                                            Loop - Actions
                                                                Unit - Create 1 Caster for (Owner of TempUnit2) at Temp_Point2 facing Default building facing degrees
                                                                Unit - Add zEnsnare Trap  to (Last created unit)
                                                                Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                                                                Unit - Order (Last created unit) to Undead Crypt Fiend - Web (Picked unit)
                                                        Custom script:   call RemoveLocation(udg_Temp_Point2)
                                                    Else - Actions
                                                        Do nothing
                                        Set TempUnit = No unit
                                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                TrapBool Equal to True
                            Then - Actions
                                Player - Add Temp_Int to (Owner of (Picked unit)) Current gold
                                Floating Text - Create floating text that reads (+ + (String(Temp_Int))) at Temp_Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
                                Floating Text - Hide (Last created floating text) for (All players)
                                Floating Text - Show (Last created floating text) for (Player group((Owner of TempUnit2)))
                                Floating Text - Change (Last created floating text): Disable permanence
                                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                                Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                                Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
                                Unit - Kill TempUnit2
                            Else - Actions
                                Do nothing
                        Set TempUnit2 = No unit
                        Custom script:   call RemoveLocation(udg_Temp_Point)
                        Set Temp_Int = 0
                        Set TrapBool = False
                    Else - Actions
                        Do nothing
                -------- Tremor Trigger --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Picked unit)) Equal to Tremor Trigger (Zack) "Dark"
                    Then - Actions
                        Set Temp_Int = (Temp_Int + 100)
                        Set Temp_Point = (Position of (Picked unit))
                        Set TempUnit2 = (Picked unit)
                        -------- Are the nearby units enemies? --------
                        Custom script:   set bj_wantDestroyGroup = true
                        Unit Group - Pick every unit in (Units within 400.00 of Temp_Point) and do (Actions)
                            Loop - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Picked unit) belongs to an enemy of (Owner of TempUnit2)) Equal to True
                                        ((Picked unit) is alive) Equal to True
                                        ((Picked unit) is A flying unit) Equal to False
                                    Then - Actions
                                        Set TempUnit = (Picked unit)
                                        -------- Explosive Trap --------
                                        Custom script:   set bj_wantDestroyGroup = true
                                        Unit Group - Pick every unit in (Units within 400.00 of Temp_Point) and do (Actions)
                                            Loop - Actions
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        (Unit-type of (Picked unit)) Equal to Explosive Trap (Zack) "Dark"
                                                        (Owner of (Picked unit)) Equal to (Owner of TempUnit2)
                                                        (Percentage life of (Picked unit)) Greater than or equal to 100.00
                                                    Then - Actions
                                                        Set TrapBool = True
                                                        Set Temp_Point2 = (Position of (Picked unit))
                                                        Special Effect - Create a special effect at Temp_Point2 using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
                                                        Special Effect - Destroy (Last created special effect)
                                                        Set Temp_Int = (Temp_Int + 112)
                                                        Unit - Kill (Picked unit)
                                                        Unit - Create 1 Caster for (Owner of TempUnit2) at Temp_Point2 facing Default building facing degrees
                                                        Unit - Add zExplosive Trap  to (Last created unit)
                                                        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                                                        Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
                                                        Custom script:   call RemoveLocation(udg_Temp_Point2)
                                                    Else - Actions
                                                        Do nothing
                                        -------- Magic Distortion Trap --------
                                        Custom script:   set bj_wantDestroyGroup = true
                                        Unit Group - Pick every unit in (Units within 400.00 of Temp_Point) and do (Actions)
                                            Loop - Actions
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        ((Picked unit) is alive) Equal to True
                                                        (Unit-type of (Picked unit)) Equal to Magic Distortion Trap (Zack) "Dark"
                                                        (Owner of (Picked unit)) Equal to (Owner of TempUnit2)
                                                        (Percentage life of (Picked unit)) Greater than or equal to 100.00
                                                    Then - Actions
                                                        Set TrapBool = True
                                                        Set Temp_Point2 = (Position of (Picked unit))
                                                        Set Temp_Int = (Temp_Int + 312)
                                                        Unit - Kill (Picked unit)
                                                        Unit - Create 1 Caster for (Owner of TempUnit2) at Temp_Point2 facing Default building facing degrees
                                                        Unit - Add zMagic Distortion Trap  to (Last created unit)
                                                        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                                                        Unit - Order (Last created unit) to Human Priest - Dispel (Last created unit)
                                                        Custom script:   call RemoveLocation(udg_Temp_Point2)
                                                    Else - Actions
                                                        Do nothing
                                        -------- Black Spider's Web Trap --------
                                        Custom script:   set bj_wantDestroyGroup = true
                                        Unit Group - Pick every unit in (Units within 400.00 of Temp_Point) and do (Actions)
                                            Loop - Actions
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        ((Picked unit) is alive) Equal to True
                                                        (Unit-type of (Picked unit)) Equal to Black Spider's Web Trap (Zack) "Dark"
                                                        (Owner of (Picked unit)) Equal to (Owner of TempUnit2)
                                                        (Percentage life of (Picked unit)) Greater than or equal to 100.00
                                                    Then - Actions
                                                        Set TrapBool = True
                                                        Set Temp_Point2 = (Position of (Picked unit))
                                                        Set Temp_Int = (Temp_Int + 156)
                                                        Unit - Kill (Picked unit)
                                                        Custom script:   set bj_wantDestroyGroup = true
                                                        Unit Group - Pick every unit in (Units within 400.00 of Temp_Point2) and do (Actions)
                                                            Loop - Actions
                                                                Unit - Create 1 Caster for (Owner of TempUnit2) at Temp_Point2 facing Default building facing degrees
                                                                Unit - Add zEnsnare Trap  to (Last created unit)
                                                                Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                                                                Unit - Order (Last created unit) to Undead Crypt Fiend - Web (Picked unit)
                                                        Custom script:   call RemoveLocation(udg_Temp_Point2)
                                                    Else - Actions
                                                        Do nothing
                                        Set TempUnit = No unit
                                    Else - Actions
                                        Do nothing
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                TrapBool Equal to True
                            Then - Actions
                                Player - Add Temp_Int to (Owner of (Picked unit)) Current gold
                                Floating Text - Create floating text that reads (+ + (String(Temp_Int))) at Temp_Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
                                Floating Text - Hide (Last created floating text) for (All players)
                                Floating Text - Show (Last created floating text) for (Player group((Owner of TempUnit2)))
                                Floating Text - Change (Last created floating text): Disable permanence
                                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                                Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                                Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
                                Unit - Kill TempUnit2
                            Else - Actions
                                Do nothing
                        Set TempUnit2 = No unit
                        Custom script:   call RemoveLocation(udg_Temp_Point)
                        Set Temp_Int = 0
                        Set TrapBool = False
                    Else - Actions
                        Do nothing

I'm still learning JASS, but from what I figured out, JASS might solve my problem, but this trigger is enormous and I want to make sure the conversion will even make a bit of difference, if it will I'll get to work, if it wont... well I'll still do it later.

PS. Part of it might be my computer not being perfect, other people seem to not get any pause's, but I still want to lower the lag if the possibility is open.
 

elmstfreddie

The Finglonger
Reaction score
203
I'm still learning JASS, but from what I figured out, JASS might solve my problem, but this trigger is enormous and I want to make sure the conversion will even make a bit of difference, if it will I'll get to work, if it wont... well I'll still do it later.

Converting it will have absolutely no effect. Rewriting it from scratch in JASS will however.
Your trigger is very long, and GUI uses lots of BJs. BJs are useless function calls, and this trigger has a TONNE of them. Every if/then/else is a useless function call. The pick every unit has a useless one (ForGroup, but that's not really a big problem).
So really, you're screwed unless you know JASS or get a JASSer to rewrite it without BJs.
 

substance

New Member
Reaction score
34
[OFFTOPIC]I just wanna say that I appreciate your honesty elmstfreddie, alot of the help on here like to beat around the bush but that's a pretty straight-forward responce and sometimes that's what people need to here.[/OFFTOPIC]
 

Zackreaver

New Member
Reaction score
2
Converting it will have absolutely no effect. Rewriting it from scratch in JASS will however.
Your trigger is very long, and GUI uses lots of BJs. BJs are useless function calls, and this trigger has a TONNE of them. Every if/then/else is a useless function call. The pick every unit has a useless one (ForGroup, but that's not really a big problem).
So really, you're screwed unless you know JASS or get a JASSer to rewrite it without BJs.

By convert, I ment rewriting in jass, not the action of just convertting to custom text. I made this trigger before I knew how to JASS, so now I'm planning to rewrite every GUI trigger I have.

At anyrate thanks for answering my problem, so I need to rewrite the code and eliminate the worthless BJ functions, turn the if/then/else function calls into if()then's, if I'm missing anything let me know thats all I asked.

I simply wanted to know if the rewrite would be worth it. I'll be back with the rewritten version if I have any future issues. Thank you.
 

Steel

Software Engineer
Reaction score
109
Yes, because every condition and multi condition function you write in GUI do several function calls.
Example

JASS:
function ConditionsOnTheActualTrigger takes nothing returns boolean
if not (AnotherCondition()) then
return false
endif
if not (AnotherCondition2()) then
return false
endif
return true
endfunction

You can optimize easily. Looking at your trigger you have a TON of if then else statements that could be optimized, fixing those would help quite a bit not to mention fixing memory leaks.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> this trigger is enormous

Indeed.
It's also pretty much impossible to guess what it is supposed to do.

If you explained that part... with any luck there's an easier or shorter way of doing it.
 
Reaction score
333
By convert, I ment rewriting in jass, not the action of just convertting to custom text. I made this trigger before I knew how to JASS, so now I'm planning to rewrite every GUI trigger I have.

At anyrate thanks for answering my problem, so I need to rewrite the code and eliminate the worthless BJ functions, turn the if/then/else function calls into if()then's, if I'm missing anything let me know thats all I asked.

I simply wanted to know if the rewrite would be worth it. I'll be back with the rewritten version if I have any future issues. Thank you.

In that case - rewriting will ALWAYS be better than GUI. Always.

I would not recommend using GUI for anything in any serious map at anytime.
 

Zackreaver

New Member
Reaction score
2
Finished, now is there anything I can do with this to make things run smoother?

JASS:




function BlackSpiderWebTrapLaunchWeb takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'e000', GetOwningPlayer(udg_TempUnit2), udg_Temp_Point2, bj_UNIT_FACING )
    call UnitAddAbility( GetLastCreatedUnit(), 'A024' )
    call UnitApplyTimedLife( GetLastCreatedUnit(), 'BTLF', 2.00 )
    call IssueTargetOrder( GetLastCreatedUnit(), "web", GetEnumUnit()  )
endfunction



function MagicDistortionTrapGroup takes nothing returns nothing
    local unit pu = GetEnumUnit()
    local location p = GetUnitLoc(pu)
    if ( IsUnitAliveBJ(pu) == true and GetUnitTypeId(pu) == 'o00N' and GetOwningPlayer(pu) == GetOwningPlayer(udg_TempUnit2)  and  GetUnitLifePercent(pu) >= 100.00 ) then
        set udg_TrapBool = true
        set udg_Temp_Int = ( udg_Temp_Int + 375 )
        call KillUnit( pu )
        call CreateNUnitsAtLoc( 1, 'e000', GetOwningPlayer(udg_TempUnit2), p, bj_UNIT_FACING )
        call UnitAddAbilityBJ( 'A023', GetLastCreatedUnit() )
        call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
        call IssueTargetOrderBJ( GetLastCreatedUnit(), "dispel", GetLastCreatedUnit() )
    endif
    call RemoveLocation(p)
    set pu = null
endfunction


function BlackSpiderWebTrapGroup takes nothing returns nothing
    local unit pu = GetEnumUnit()
    local location p = GetUnitLoc(pu)
    local group g
    if ( IsUnitAliveBJ(pu) == true and GetUnitTypeId(pu) == 'o00O' and GetOwningPlayer(pu) == GetOwningPlayer(udg_TempUnit2) and GetUnitLifePercent(pu) >= 100.00  ) then
        set udg_TrapBool = true
        set udg_Temp_Int = ( udg_Temp_Int + 188 )
        call KillUnit(pu)
        set g = GetUnitsInRangeOfLocAll(400.00, p)
        set udg_Temp_Point2 = p
        call ForGroup( g, function BlackSpiderWebTrapLaunchWeb )
        call RemoveLocation(udg_Temp_Point2)
        call DestroyGroup(g)
    endif
    call RemoveLocation(p)
endfunction


function ExplosiveTrapGroup takes nothing returns nothing
    local unit pu = GetEnumUnit()
    local location p = GetUnitLoc(pu)
    if ( IsUnitAliveBJ(pu) == true and GetUnitLifePercent(pu) >= 100.00 and GetUnitTypeId(pu) == 'o00G' and GetOwningPlayer(GetEnumUnit()) == GetOwningPlayer(udg_TempUnit2) ) then
        set udg_TrapBool = true
        call AddSpecialEffectLocBJ( p, "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl" )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        set udg_Temp_Int = ( udg_Temp_Int + 135 )
        call KillUnit( pu )
        call CreateNUnitsAtLoc( 1, 'e000', GetOwningPlayer(udg_TempUnit2),  p, bj_UNIT_FACING )
        call UnitAddAbility( GetLastCreatedUnit(), 'A01V' ) 
        call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit())
        call IssueImmediateOrderBJ( GetLastCreatedUnit(), "thunderclap" )
    endif
    call RemoveLocation(p)
endfunction


function DarknessTrapGroups takes nothing returns nothing
    local unit pu = GetEnumUnit()
    local group g
    local location p = GetUnitLoc(pu)
    if ( IsUnitEnemy(pu, GetOwningPlayer(udg_TempUnit2)) == true and IsUnitAliveBJ(pu) == true ) then
        set udg_TempUnit = pu


        set g = GetUnitsInRangeOfLocAll(400.00, p)


        // Explosive Trap
        call ForGroup( g, function ExplosiveTrapGroup )


        // Magic Distortion Trap
        call ForGroup( g, function MagicDistortionTrapGroup )


        // Black Spider's Web Trap
        call ForGroup( g, function BlackSpiderWebTrapGroup )

        call DestroyGroup(g)
        set udg_TempUnit = null
    endif
    call RemoveLocation(p)
endfunction


function BurningBuildingGroup takes nothing returns nothing
    local unit pu = GetEnumUnit()
    local location p = GetUnitLoc(pu)
    local texttag tt
    if ( IsUnitType(pu, UNIT_TYPE_STRUCTURE) == true and GetUnitTypeId(pu) != 'o008' and IsUnitAliveBJ(pu) == true  and IsUnitEnemy(pu, GetOwningPlayer(udg_TempUnit)) == true ) then

        call DestroyEffect( AddSpecialEffectLoc( "Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl", p ) )
        call UnitDamageTargetBJ( udg_TempUnit, pu, 20.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_FIRE )

            call CreateTextTagLocBJ( ("+3"), p, 0, 10, 100, 100, 0.00, 0)
            set tt = bj_lastCreatedTextTag
            call ShowTextTagForceBJ( false, tt, GetPlayersAll() )
            call ShowTextTagForceBJ( true, tt, GetForceOfPlayer(GetOwningPlayer(pu)) )
            call SetTextTagPermanent( tt, false )
            call SetTextTagVelocityBJ( tt, 64, 90 )
            call SetTextTagLifespan( tt, 5 )
            call SetTextTagFadepoint( tt, 3.00 )
            set tt = null
        call RemoveLocation(p)
    endif
endfunction


function DestructableBurnGroup takes nothing returns nothing
    local destructable d = GetEnumDestructable()
    local location p = GetDestructableLoc(d)
    local unit pu = GetEnumUnit()
    local texttag tt

    if (GetDestructableTypeId(d) != 'LTrc' and GetDestructableLife(d) > 0  ) then
 
        call DestroyEffect( AddSpecialEffectLoc( "Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl", p ) )
        call SetDestructableLife( d, ( GetDestructableLife(d) - 5.00 ) )
        if ( GetDestructableTypeId(GetEnumDestructable()) == 'B000' ) then
            call AdjustPlayerStateBJ( 2, GetOwningPlayer(pu), PLAYER_STATE_RESOURCE_GOLD )
            call CreateTextTagLocBJ( ("+2"), p, 0, 10, 100, 100, 0.00, 0)
            set tt = bj_lastCreatedTextTag
            call ShowTextTagForceBJ( false, tt, GetPlayersAll() )
            call ShowTextTagForceBJ( true, tt, GetForceOfPlayer(GetOwningPlayer(pu)) )
            call SetTextTagPermanent( tt, false )
            call SetTextTagVelocityBJ( tt, 64, 90 )
            call SetTextTagLifespan( tt, 5 )
            call SetTextTagFadepoint( tt, 3.00 )
            set tt = null
        else
            call AdjustPlayerStateBJ( 1, GetOwningPlayer(GetEnumUnit()), PLAYER_STATE_RESOURCE_GOLD )
            call CreateTextTagLocBJ( ("+1"), p, 0, 10, 100, 100, 0.00, 0)
            set tt = bj_lastCreatedTextTag
            call ShowTextTagForceBJ( false, tt, GetPlayersAll() )
            call ShowTextTagForceBJ( true, tt, GetForceOfPlayer(GetOwningPlayer(pu)) )
            call SetTextTagPermanent( tt, false )
            call SetTextTagVelocityBJ( tt, 64, 90 )
            call SetTextTagLifespan( tt, 5 )
            call SetTextTagFadepoint( tt, 3.00 )
            set tt = null
        endif

    endif
    call RemoveLocation(p)

endfunction


function RainableStructure takes unit pu returns boolean

    if ( GetUnitTypeId(pu) == 'e003' ) then
        return true
    elseif ( GetUnitTypeId(pu) == 'n005' ) then
        return true
    endif

return false

endfunction

function PeriodicOneSecondJassRemakeGroup takes nothing returns nothing
    local integer i
    local location p
    local unit u
    local unit pu = GetEnumUnit()
    local texttag tt
    local group g

    // Twilight Fortress Immobility
    if ( (GetTimeOfDay() >= 5.99 and GetTimeOfDay() <= 18.00) and (GetUnitTypeId(pu) == 'o00J' or GetUnitTypeId(pu) == 'o00J')) then
        call UnitAddAbility( GetEnumUnit(), 'A031' )
    endif
    if (  (GetTimeOfDay() < 5.99 or GetTimeOfDay() > 18.00) and (GetUnitTypeId(pu) == 'o00J' or GetUnitTypeId(pu) == 'o00J') ) then
        call UnitRemoveAbility(  GetEnumUnit(), 'A031' )
    endif


    // Godfather Upgrade Skill Level
    if ( GetUnitTypeId(pu) == 'e007' and GetUnitAbilityLevelSwapped('A011', pu) != 1 ) then
        call SetUnitAbilityLevelSwapped( 'A011', pu, 1 )
    endif
    if (GetUnitTypeId(pu) == 'e00L' and GetUnitAbilityLevelSwapped('A011', pu) != 2 ) then
        call SetUnitAbilityLevelSwapped( 'A011', pu, 2 )
    endif
    if (GetUnitTypeId(pu) == 'e00P' and GetUnitAbilityLevelSwapped('A011', pu) != 3 ) then
        call SetUnitAbilityLevelSwapped( 'A011', pu, 3 )
    endif
    if (GetUnitTypeId(pu) == 'e010' and GetUnitAbilityLevelSwapped('A011', pu) != 3 ) then
        call SetUnitAbilityLevelSwapped( 'A011', pu, 3 )
    endif



    // Dark Shroud Invisibility
    if ( UnitHasBuffBJ( pu, 'B00H') == true  ) then
        call UnitAddAbility( pu, 'A01N' )
    else
        call UnitRemoveAbility( pu, 'A01N')
    endif



    // Dark Resource Harvest
    if ( GetUnitAbilityLevel(pu, 'B00F') > 0 and GetUnitCurrentOrder(pu) == String2OrderIdBJ("starfall")  ) then
            set p = GetUnitLoc(pu)
            if ( GetTimeOfDay() >= 12.00 ) then
                set i = ( R2I(GetTimeOfDay()) - 12 )
                set i = ( udg_Temp_Int + ( R2I(( GetUnitStateSwap(UNIT_STATE_MAX_LIFE, pu) - GetUnitStateSwap(UNIT_STATE_LIFE, pu) )) / 30 ) )
            endif

            if ( GetTimeOfDay() < 12.00 ) then
                set i = ( 12 - R2I(GetTimeOfDay()) )
                set i = ( i + ( R2I(( GetUnitStateSwap(UNIT_STATE_MAX_LIFE, pu) - GetUnitStateSwap(UNIT_STATE_LIFE, pu) )) / 30 ) )
            endif
            call SetUnitLifeBJ( pu, ( GetUnitStateSwap(UNIT_STATE_LIFE, pu) - 10.00 ) )
            call AdjustPlayerStateBJ( i, GetOwningPlayer(pu), PLAYER_STATE_RESOURCE_GOLD )


            call CreateTextTagLocBJ( ("+" + I2S(i)), p, 0, 10, 100, 100, 0.00, 0)
            set tt = bj_lastCreatedTextTag
            call ShowTextTagForceBJ( false, tt, GetPlayersAll() )
            call ShowTextTagForceBJ( true, tt, GetForceOfPlayer(GetOwningPlayer(pu)) )
            call SetTextTagPermanent( tt, false )
            call SetTextTagVelocityBJ( tt, 64, 90 )
            call SetTextTagLifespan( tt, 5 )
            call SetTextTagFadepoint( tt, 3.00 )
            call DestroyEffect( AddSpecialEffectLoc( "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl", p ) )
            set i = 0
            call RemoveLocation(p)
    endif



    // Rain Resource Harvest
    if ( GetUnitAbilityLevel(pu, 'B005') > 0) then
        if ( RainableStructure(pu) ) then

            call SetUnitState(pu, UNIT_STATE_MANA, RMaxBJ(0, GetUnitStateSwap(UNIT_STATE_MANA, pu) + 5.00 ))

        endif
        call AdjustPlayerStateBJ( 1, GetOwningPlayer(pu), PLAYER_STATE_RESOURCE_GOLD )
        set p = GetUnitLoc(pu)
        call CreateTextTagLocBJ( "+1", p, 0, 10, 100, 100, 0.00, 0)
        set tt = bj_lastCreatedTextTag
        call ShowTextTagForceBJ( false, tt, GetPlayersAll() )
        call ShowTextTagForceBJ( true, tt, GetForceOfPlayer(GetOwningPlayer(pu)) )
        call SetTextTagPermanent( tt, false )
        call SetTextTagVelocityBJ( tt, 64, 90 )
        call SetTextTagLifespan( tt, 5 )
        call SetTextTagFadepoint( tt, 3.00 )
        set tt = null
        call RemoveLocation(p)
    endif




    // Mist Form
    if ( GetUnitAbilityLevel(pu, 'B008') > 0 ) then
        call UnitAddAbility( pu, 'A00P')
    else
        call UnitRemoveAbility( pu, 'A00P' )
    endif



    // Fire Resource Harvest
    if ( GetUnitTypeId(GetEnumUnit()) == 'h001' ) then
        call SetUnitLifeBJ( GetEnumUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetEnumUnit()) - 10.00 ) )
        set p = GetUnitLoc(pu)

        //FloatingText
            call CreateTextTagLocBJ( ("+1"), p, 0, 10, 100, 100, 0.00, 0)
            set tt = bj_lastCreatedTextTag
            call ShowTextTagForceBJ( false, tt, GetPlayersAll() )
            call ShowTextTagForceBJ( true, tt, GetForceOfPlayer(GetOwningPlayer(pu)) )
            call SetTextTagPermanent( tt, false )
            call SetTextTagVelocityBJ( tt, 64, 90 )
            call SetTextTagLifespan( tt, 5 )
            call SetTextTagFadepoint( tt, 3.00 )
        //FloatingText

        call AdjustPlayerStateBJ( 1, GetOwningPlayer(GetEnumUnit()), PLAYER_STATE_RESOURCE_GOLD )
        call EnumDestructablesInCircleBJ( 290.00, p, function DestructableBurnGroup )
        set udg_TempUnit = pu
        set g = GetUnitsInRangeOfLocAll(290, p)
        call ForGroup( g, function BurningBuildingGroup )
        call DestroyGroup(g)
        set udg_TempUnit = null
        call RemoveLocation(p)
    endif


    // Trap Trigger
    // Motion Trigger
    if ( GetUnitTypeId(GetEnumUnit()) == 'o00F' ) then
        set udg_Temp_Int = ( udg_Temp_Int + 100 )
        set p = GetUnitLoc(pu)
        set udg_TempUnit2 = pu

        // Are the nearby units enemies?
        set g = GetUnitsInRangeOfLocAll(400.00, p)
        call ForGroup( g, function DarknessTrapGroups )
        call DestroyGroup(g)
        if ( udg_TrapBool == true ) then
            call AdjustPlayerStateBJ( udg_Temp_Int, GetOwningPlayer(GetEnumUnit()), PLAYER_STATE_RESOURCE_GOLD )

            //FloatingText
            call CreateTextTagLocBJ( ("+" + I2S(udg_Temp_Int)), p, 0, 10, 100, 100, 0.00, 0)
            set tt = bj_lastCreatedTextTag
            call ShowTextTagForceBJ( false, tt, GetPlayersAll() )
            call ShowTextTagForceBJ( true, tt, GetForceOfPlayer(GetOwningPlayer(pu)) )
            call SetTextTagPermanent( tt, false )
            call SetTextTagVelocityBJ( tt, 64, 90 )
            call SetTextTagLifespan( tt, 5 )
            call SetTextTagFadepoint( tt, 3.00 )
            //FloatingText

            call KillUnit( udg_TempUnit2 )
        endif
        set udg_TempUnit2 = null
        call RemoveLocation(p)
        set udg_Temp_Int = 0
        set udg_TrapBool = false
    endif


    // Tremor Trigger
    if ( GetUnitTypeId(GetEnumUnit()) == 'o00I' ) then
        set udg_Temp_Int = ( udg_Temp_Int + 100 )
        set p = GetUnitLoc(pu)
        set udg_TempUnit2 = pu

        // Are the nearby units enemies?
        set g = GetUnitsInRangeOfLocAll(400.00, p)
        call ForGroupBJ( g, function DarknessTrapGroups )
        call DestroyGroup(g)
        if (  udg_TrapBool == true ) then
            call AdjustPlayerStateBJ( udg_Temp_Int, GetOwningPlayer(pu), PLAYER_STATE_RESOURCE_GOLD )

            //FloatingText
            call CreateTextTagLocBJ( ("+" + I2S(udg_Temp_Int)), p, 0, 10, 100, 100, 0.00, 0)
            set tt = bj_lastCreatedTextTag
            call ShowTextTagForceBJ( false, tt, GetPlayersAll() )
            call ShowTextTagForceBJ( true, tt, GetForceOfPlayer(GetOwningPlayer(pu)) )
            call SetTextTagPermanent( tt, false )
            call SetTextTagVelocityBJ( tt, 64, 90 )
            call SetTextTagLifespan( tt, 5 )
            call SetTextTagFadepoint( tt, 3.00 )
            //FloatingText

            call KillUnit( udg_TempUnit2 )
        endif
        set udg_TempUnit2 = null
        call RemoveLocation(p)
        set udg_Temp_Int = 0
        set udg_TrapBool = false
    endif
endfunction

function PeriodicOneSecondJassRemakeMain takes nothing returns nothing
    local group g = GetUnitsInRectAll(GetPlayableMapRect())
    call ForGroup( g, function PeriodicOneSecondJassRemakeGroup )
    call DestroyGroup(g)
endfunction

//===========================================================================
function InitTrig_Periodic_1_Second_Jass_Remake takes nothing returns nothing
    local trigger t
    set t = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( t, 1.00 )
    call TriggerAddAction( t, function PeriodicOneSecondJassRemakeMain )
endfunction
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
Not run that trigger every second.... You are running through all of those actions once for every unit on your map, every second of the game. May I suggest instead keeping a running list (or group) of all units that would be affected. Like, all units that meet your requirements... Maybe add an action on UnitEnterRect or whatever it is, and the rect as the playable map area, then, if it meets the conditions, add it to the list. Whenever you loop through the list, and a unit doesn't meet any of the conditions, remove it from the list/group. Whenever you do something that could add a unit to the group, add it in that trigger. That should help (assuming you have many units that ARENT affected by this trigger).
 

Sooda

Diversity enchants
Reaction score
318
> Finished, now is there anything I can do with this to make things run smoother?

Yes, alot, I would do it from beginning again. There is one big mistake - overall consept.
I checked your first GUI trigger and there seems to be many different ability actions what don' t have to do nothing with eachother.
Fixing GUI JASS by just removing some parts of useless actions still keeps the old unefficient JASS structure.
These buffs should be detectable when unit gets them first place. So give info how does units get Mist Form buff. First trigger part gives/ takes ability by checking game time. Second part what looks very ood (each second) you set spesific unit' s ability back to fixed level. Why you are doing that ? There is only second to level up ability before you set it back. What is point of that ability then ? Can units use that ability each second and only before it is reset again ? What triggers "gains level of ability" so you have to set it back ?
Third part is for resource gathering, that part looks most logical to have 1 second timer. Fourth part are different kind of traps and in beginning one? "motion" aka moving actions.
That motion trigger activates traps, there are many trap types. What does that motion exactly in your map ?
In first trap it picks in 400 range each unit (matching unit) and then picks again each unit in 400 of that picked unit (matching unit), lready that loop looks really odd. What it should do ? Please explane each what does each trap ? I would guess in many case we could just use "unit enters to range of trap unit" event.
When you have explaned what actually your trigger (action) parts should do we can start to really optimise it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top