• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Where leaks or why did lag

Status
Not open for further replies.
Level 1
Joined
Jun 1, 2012
Messages
1
Map is very laging then playing please help me.
I upload map
EA Start
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Shoot Arrow
  • Actions
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • -------- Starting --------
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • MUI1 Equal to 0
      • Then - Actions
        • Trigger - Turn on EA Movement <gen>
      • Else - Actions
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • -------- Creating the current instanceo --------
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • Set MUI1 = (MUI1 + 1)
    • Set MUI2 = (MUI2 + 1)
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • -------- Configurations for the instance --------
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • Set EA_cUnit[MUI2] = (Triggering unit)
    • Set EA_cPoint[MUI2] = (Position of (Triggering unit))
    • Set EA_tPoint = (Target point of ability being cast)
    • Set EA_Angle[MUI2] = (Angle from EA_cPoint[MUI2] to EA_tPoint)
    • Set EA_Distance[MUI2] = 0.00
    • -------- test --------
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • -------- Dummy for the arrow --------
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • Unit - Create 1 Projectile Dummy for (Owner of (Triggering unit)) at EA_cPoint[MUI2] facing EA_tPoint
    • Set EA_Dummy[MUI2] = (Last created unit)
    • Animation - Change EA_Dummy[MUI2] flying height to 70.00 at 0.00
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • -------- These 2 below are very important --------
    • -------- Don't miss them, they are the key of the entire spell --------
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • Set EA_Timer[MUI2] = 0.00
    • Set EA_Level[MUI2] = 0
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • -------- Clearing possible leak --------
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • Custom script: call RemoveLocation (udg_EA_tPoint)
EA Movement
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • -------- Looping through all running instances --------
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • For each (Integer MUI3) from 1 to MUI2, do (Actions)
      • Loop - Actions
        • -------- --------------------------------------------------------------------------------------------------------- --------
        • -------- Getting position, angles and moving the dummy --------
        • -------- --------------------------------------------------------------------------------------------------------- --------
        • Set EA_bPoint[MUI3] = (Position of EA_Dummy[MUI3])
        • Set EA_mPoint[MUI3] = (EA_bPoint[MUI3] offset by 25.00 towards EA_Angle[MUI3] degrees)
        • Set EA_Angle[MUI3] = (Angle from EA_cPoint[MUI3] to EA_mPoint[MUI3])
        • Unit - Move EA_Dummy[MUI3] instantly to EA_mPoint[MUI3]
        • -------- --------------------------------------------------------------------------------------------------------- --------
        • -------- Saving the distance for later use --------
        • -------- --------------------------------------------------------------------------------------------------------- --------
        • Set EA_Distance[MUI3] = (Distance between EA_cPoint[MUI3] and EA_mPoint[MUI3])
        • -------- --------------------------------------------------------------------------------------------------------- --------
        • -------- Timer increment is very specific - don't change it --------
        • -------- --------------------------------------------------------------------------------------------------------- --------
        • Set EA_Timer[MUI3] = (EA_Timer[MUI3] + 4.13)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • EA_Timer[MUI3] Greater than or equal to 33.00
          • Then - Actions
            • -------- --------------------------------------------------------------------------------------------------------- --------
            • -------- This means, whenever the arrow travels 200 units, it means 1 second have passed --------
            • -------- Thus, we have to increase the level of the stun ability which will be cast when it hits a target --------
            • -------- Note: Level will increase by 1 for each 200 units, reaching level 10 (5 seconds stun) at 2000 range --------
            • -------- --------------------------------------------------------------------------------------------------------- --------
            • Set EA_Level[MUI3] = (EA_Level[MUI3] + 1)
            • Set EA_Timer[MUI3] = 0.00
          • Else - Actions
        • -------- --------------------------------------------------------------------------------------------------------- --------
        • -------- The unit-group for the arrow and a specific unit for (the first from that group) --------
        • -------- Which will be hit by the arrow if its an actual unit --------
        • -------- --------------------------------------------------------------------------------------------------------- --------
        • Set EA_Targets[MUI3] = (Units within 125.00 of EA_mPoint[MUI3] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Unit-type of (Matching unit)) Not equal to Arrow) and (((Matching unit) belongs to an enemy of (Owner of
        • Custom script: set udg_EA_HitUnit = FirstOfGroup(udg_EA_Targets[udg_MUI3])
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Or - Any (Conditions) are true
              • Conditions
                • ((Playable map area) contains EA_Dummy[MUI3]) Equal to False
                • EA_Distance[MUI3] Greater than or equal to 2000.00
                • EA_HitUnit Not equal to No unit
          • Then - Actions
            • -------- --------------------------------------------------------------------------------------------------------- --------
            • -------- Please note that this will also be executed if the arrow reaches the final point --------
            • -------- The trigger was causing me some bugs so I merged the ITE functions --------
            • -------- Thus I made the code smaller --------
            • -------- On top of that a small summon won't hurt that much --------
            • -------- --------------------------------------------------------------------------------------------------------- --------
            • Set Damage = (Intelligence of EA_cUnit[MUI3] (Include bonuses))
            • Set CritChance = (Real((Agility of EA_cUnit[MUI3] (Include bonuses))))
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Random real number between 1.00 and 100.00) Less than or equal to CritChance
              • Then - Actions
                • Set MissChange = (Real((Agility of EA_HitUnit (Include bonuses))))
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (EA_HitUnit has buff Evade aura ) Equal to True
                    • (Random real number between 1.00 and 100.00) Less than or equal to MissChange
                  • Then - Actions
                    • Floating Text - Create floating text that reads (|CFF790000 + (Miss + |r)) above EA_HitUnit with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                    • Floating Text - Change (Last created floating text): Disable permanence
                    • Floating Text - Set the velocity of (Last created floating text) to 80.00 towards 45.00 degrees
                    • Floating Text - Change the lifespan of (Last created floating text) to 1.25 seconds
                    • Floating Text - Change the fading age of (Last created floating text) to 0.90 seconds
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • -------- Clearing all dummies the current instance configurations --------
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • Unit - Kill EA_Dummy[MUI3]
                    • Set EA_Dummy[MUI3] = No unit
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • -------- Dont forget to reset the timer - it may start from a different value for the next time and ruin the spell --------
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • Set EA_Timer[MUI3] = 0.00
                    • Custom script: call RemoveLocation (udg_EA_cPoint[udg_MUI3])
                    • Set MUI1 = (MUI1 - 1)
                  • Else - Actions
                    • Unit - Create 1 Caster Dummy for (Owner of EA_Dummy[MUI3]) at EA_mPoint[MUI3] facing Default building facing degrees
                    • Unit - Add Stun to (Last created unit)
                    • Unit - Set level of Stun for (Last created unit) to EA_Level[MUI3]
                    • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt EA_HitUnit
                    • Unit - Cause EA_cUnit[MUI3] to damage EA_HitUnit, dealing (0.00 + (2.00 x (Real(Damage)))) damage of attack type Normal and damage type Normal
                    • Floating Text - Create floating text that reads (|CFF790000 Critical + (- + ( + ((String((2 x Damage))) + |r)))) above EA_HitUnit with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                    • Floating Text - Change (Last created floating text): Disable permanence
                    • Floating Text - Set the velocity of (Last created floating text) to 80.00 towards 45.00 degrees
                    • Floating Text - Change the lifespan of (Last created floating text) to 1.25 seconds
                    • Floating Text - Change the fading age of (Last created floating text) to 0.90 seconds
                    • Set DamageDone = (DamageDone + Damage)
                    • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                    • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • -------- Clearing all dummies the current instance configurations --------
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • Unit - Kill EA_Dummy[MUI3]
                    • Set EA_Dummy[MUI3] = No unit
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • -------- Dont forget to reset the timer - it may start from a different value for the next time and ruin the spell --------
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • Set EA_Timer[MUI3] = 0.00
                    • Custom script: call RemoveLocation (udg_EA_cPoint[udg_MUI3])
                    • Set MUI1 = (MUI1 - 1)
              • Else - Actions
                • Set MissChange = (Real((Agility of EA_HitUnit (Include bonuses))))
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (EA_HitUnit has buff Evade aura ) Equal to True
                    • (Random real number between 1.00 and 100.00) Less than or equal to MissChange
                  • Then - Actions
                    • Floating Text - Create floating text that reads (|CFF790000 + (Miss + |r)) above EA_HitUnit with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                    • Floating Text - Change (Last created floating text): Disable permanence
                    • Floating Text - Set the velocity of (Last created floating text) to 80.00 towards 45.00 degrees
                    • Floating Text - Change the lifespan of (Last created floating text) to 1.25 seconds
                    • Floating Text - Change the fading age of (Last created floating text) to 0.90 seconds
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • -------- Clearing all dummies the current instance configurations --------
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • Unit - Kill EA_Dummy[MUI3]
                    • Set EA_Dummy[MUI3] = No unit
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • -------- Dont forget to reset the timer - it may start from a different value for the next time and ruin the spell --------
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • Set EA_Timer[MUI3] = 0.00
                    • Custom script: call RemoveLocation (udg_EA_cPoint[udg_MUI3])
                    • Set MUI1 = (MUI1 - 1)
                  • Else - Actions
                    • Unit - Create 1 Caster Dummy for (Owner of EA_Dummy[MUI3]) at EA_mPoint[MUI3] facing Default building facing degrees
                    • Unit - Add Stun to (Last created unit)
                    • Unit - Set level of Stun for (Last created unit) to EA_Level[MUI3]
                    • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt EA_HitUnit
                    • Set Damage = (Intelligence of EA_cUnit[MUI3] (Include bonuses))
                    • Set CritChance = (Real((Agility of EA_cUnit[MUI3] (Include bonuses))))
                    • Unit - Cause EA_cUnit[MUI3] to damage EA_HitUnit, dealing (0.00 + (1.00 x (Real((Intelligence of EA_cUnit[MUI3] (Include bonuses)))))) damage of attack type Normal and damage type Normal
                    • Floating Text - Create floating text that reads (|CFF790000 + (- + ( + ((String(Damage)) + |r)))) above EA_HitUnit with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                    • Floating Text - Change (Last created floating text): Disable permanence
                    • Floating Text - Set the velocity of (Last created floating text) to 80.00 towards 45.00 degrees
                    • Floating Text - Change the lifespan of (Last created floating text) to 1.25 seconds
                    • Floating Text - Change the fading age of (Last created floating text) to 0.90 seconds
                    • Set DamageDone = (DamageDone + Damage)
                    • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                    • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • -------- Clearing all dummies the current instance configurations --------
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • Unit - Kill EA_Dummy[MUI3]
                    • Set EA_Dummy[MUI3] = No unit
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • -------- Dont forget to reset the timer - it may start from a different value for the next time and ruin the spell --------
                    • -------- --------------------------------------------------------------------------------------------------------- --------
                    • Set EA_Timer[MUI3] = 0.00
                    • Custom script: call RemoveLocation (udg_EA_cPoint[udg_MUI3])
                    • Set MUI1 = (MUI1 - 1)
          • Else - Actions
        • -------- --------------------------------------------------------------------------------------------------------- --------
        • -------- Clearing all possible leaks for the looped instance --------
        • -------- --------------------------------------------------------------------------------------------------------- --------
        • Custom script: call DestroyGroup (udg_EA_Targets[udg_MUI3])
        • Custom script: set udg_EA_HitUnit = null
        • Custom script: call RemoveLocation (udg_EA_bPoint[udg_MUI3])
        • Custom script: call RemoveLocation (udg_EA_mPoint[udg_MUI3])
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • -------- If all instances are done - stopping the trigger to prevent lag or memory loss --------
    • -------- --------------------------------------------------------------------------------------------------------- --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • MUI1 Equal to 0
      • Then - Actions
        • Set MUI2 = 0
        • Trigger - Turn off (This trigger)
      • Else - Actions
EA Preload
  • Events
    • Time - Elapsed game time is 0.01 seconds
  • Conditions
  • Actions
    • -------- ----------------------------------------------------------------------------------------------------- --------
    • -------- Point for preload --------
    • -------- ----------------------------------------------------------------------------------------------------- --------
    • Set Preload_Point = (Center of (Playable map area))
    • -------- ----------------------------------------------------------------------------------------------------- --------
    • -------- Dummy for the abilities --------
    • -------- ----------------------------------------------------------------------------------------------------- --------
    • Unit - Create 1 Caster Dummy for Neutral Passive at Preload_Point facing Default building facing degrees
    • Unit - Add Shoot Arrow to (Last created unit)
    • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
    • -------- ----------------------------------------------------------------------------------------------------- --------
    • -------- Preloading SFXs as well --------
    • -------- ----------------------------------------------------------------------------------------------------- --------
    • Special Effect - Create a special effect at Preload_Point using Abilities\Weapons\BallistaMissile\BallistaMissile.mdl
    • Special Effect - Destroy (Last created special effect)
    • -------- ----------------------------------------------------------------------------------------------------- --------
    • -------- Clearing possible leak --------
    • -------- ----------------------------------------------------------------------------------------------------- --------
    • Custom script: call RemoveLocation (udg_Preload_Point)
 

Attachments

  • archer wars.zip
    1.4 MB · Views: 71
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

Well I just played it for about 20 minutes now with a friend and we hadn't any lag.

I don't know GUI that good anymore, so I don't know if there are any leaks, but MortAr knows what hes doing, just one think is wrong:
- The arrow can stuck at the egde of the map sometimes, so the spell never ends.

Other small tips:
- You always should use only 1 trigger with the event "Map Initialization".
- Your salary trigger is useless, because you just need on trigger, runes every 1.00 seconds and gives cash to the player. Also I would say you can use a loop here. In addition you should check if the player is still in game or not.
- All the Victory Commands can be done in just one loop trigger.
- Are you sure that revive system works without any problems? I'm not.

But anyway as I said, we hadn't any lags.

Greetings and Peace
Dr. Boom
 
Status
Not open for further replies.
Top