• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Trigger] Major Lag Problem

Status
Not open for further replies.
Level 7
Joined
Oct 13, 2008
Messages
299
Aight', i've created an ability for the Ranger in my map in which she shoots multiple arrows that damage any foe on impact. The actual spell works perfectly, but after testing it for 8-9 times, my FPS drops down to 3-4.

I checked for leaks with Leak checker, and none were found. I also reduced the movement triggers speed from every 0.01 second to 0.03, Still lags.

Code:

Initilzation Trigger:

  • Scattering Shot
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Scattering Shot
    • Actions
      • Countdown Timer - Start SCS_Timer as a One-shot timer that will expire in 0.20 seconds
      • -------- --------
      • Set AbilityName = (Name of (Ability being cast))
      • Floating Text - Create floating text that reads AbilityName above (Triggering unit) with Z offset 0.00, using font size 9.00, color (80.00%, 80.00%, 80.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 135.00 towards 90.00 degrees
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 0.80 seconds
      • -------- --------
      • Set Ranger_Caster[5] = (Triggering unit)
      • Set SCS_SpreadAngle[1] = (Facing of Ranger_Caster[5])
      • -------- --------
      • Set SCS_Damage[1] = (Random integer number between 35 and 70)
      • Set SCS_Damage[2] = (Random integer number between 50 and 90)
      • Set SCS_Damage[3] = (Random integer number between 70 and 110)
      • Set SCS_Damage[4] = (Level of Scattering Shot for Ranger_Caster[5])
      • -------- --------
      • Set SCS_Attribute[1] = ((Agility of Ranger_Caster[5] (Include bonuses)) x (Level of Scattering Shot for Ranger_Caster[5]))
      • -------- --------
      • Set SCS_Damage[5] = (SCS_Damage[4] + SCS_Attribute[1])
      • -------- --------
      • -------- Settings --------
      • -------- --------
      • Set SCS_LeakRemovalCounter = 0
      • Set SCS_Integer = 1
      • Set SCS_Speed = 42.80
      • -------- --- Amount of arrows shot --- --------
      • Set SCS_DummyCount = 8
      • -------- --- Maximum total angle of the arrows --- --------
      • Set SCS_MaxAngle = 35.00
      • -------- --- Angle in which the first arrow will deployed into --- --------
      • Set SCS_StartingAngle = SCS_MaxAngle
      • -------- --- The angle reduction when deploying arrows --- --------
      • Set SCS_AngleReduction = (SCS_MaxAngle / ((Real(SCS_DummyCount)) / 2.00))
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Hawks Eye for Ranger_Caster[5]) Equal to 1
        • Then - Actions
          • Set Hawk_Eye_Bool = True
          • Set Ranger_Crit_Chance = 5
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Hawks Eye for Ranger_Caster[5]) Equal to 2
            • Then - Actions
              • Set Hawk_Eye_Bool = True
              • Set Ranger_Crit_Chance = 8
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Hawks Eye for Ranger_Caster[5]) Equal to 3
                • Then - Actions
                  • Set Hawk_Eye_Bool = True
                  • Set Ranger_Crit_Chance = 11
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Hawks Eye for Ranger_Caster[5]) Equal to 4
                    • Then - Actions
                      • Set Hawk_Eye_Bool = True
                      • Set Ranger_Crit_Chance = 14
                    • Else - Actions
      • -------- --------
Deployment Trigger:

  • SCS Dummy Deployment
    • Events
      • Time - SCS_Timer expires
    • Conditions
    • Actions
      • For each (Integer SCS_Integer) from 1 to SCS_DummyCount, do (Actions)
        • Loop - Actions
          • Set SCS_LeakRemovalCounter = (SCS_LeakRemovalCounter + 1)
          • Set SCS_Point[1] = (Position of Ranger_Caster[5])
          • Set SCS_Point[2] = (SCS_Point[1] offset by 30.00 towards SCS_SpreadAngle[1] degrees)
          • Unit - Create 1 Arrow Dummy 4 for (Owner of Ranger_Caster[5]) at SCS_Point[2] facing (SCS_SpreadAngle[1] + SCS_StartingAngle) degrees
          • Set SCS_Dummy = (Last created unit)
          • Unit - Add a 1.50 second Generic expiration timer to SCS_Dummy
          • Unit - Turn collision for SCS_Dummy Off
          • Unit Group - Add SCS_Dummy to SCS_Group
          • Set SCS_StartingAngle = (SCS_StartingAngle - SCS_AngleReduction)
          • Custom script: call RemoveLocation(udg_SCS_Point[1])
          • Custom script: call RemoveLocation(udg_SCS_Point[2])
      • Trigger - Turn on SCS Dummy Movement <gen>
Movement Trigger:

  • SCS Dummy Movement
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in SCS_Group and do (Actions)
        • Loop - Actions
          • Set SCS_Dummy2 = (Picked unit)
          • Set SCS_Point[3] = (Position of SCS_Dummy2)
          • Set SCS_Point[4] = (SCS_Point[3] offset by SCS_Speed towards (Facing of SCS_Dummy2) degrees)
          • -------- -- --------
          • Unit - Move SCS_Dummy2 instantly to SCS_Point[4]
          • -------- -- --------
          • Set SCS_TGRoup = (Units within 350.00 of SCS_Point[3] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Ranger_Caster[5])) Equal to True))))
          • -------- -- --------
          • Unit Group - Pick every unit in SCS_TGRoup and do (Set SCS_Targed = (Picked unit))
          • Set SCS_Point[5] = (Position of SCS_Targed)
          • Custom script: call DestroyGroup(udg_SCS_TGRoup)
          • -------- -- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Distance between SCS_Point[3] and SCS_Point[5]) Less than or equal to 90.00
                  • (SCS_Dummy2 is alive) Equal to True
            • Then - Actions
              • Unit - Kill SCS_Dummy2
            • Else - Actions
          • -------- -- --------
          • Custom script: call RemoveLocation(udg_SCS_Point[3])
          • Custom script: call RemoveLocation(udg_SCS_Point[4])
          • Custom script: call RemoveLocation(udg_SCS_Point[5])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (SCS_Group is empty) Equal to True
            • Then - Actions
              • Custom script: call DestroyGroup(udg_SCS_Group)
              • Trigger - Turn off (This trigger)
            • Else - Actions
 
  • (Level of Hawks Eye for Ranger_Caster[5]) Equal to 1
  • Then - Actions
  • Set Hawk_Eye_Bool = True
  • Set Ranger_Crit_Chance = 5
  • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Level of Hawks Eye for Ranger_Caster[5]) Equal to 2
  • Then - Actions
  • Set Hawk_Eye_Bool = True
  • Set Ranger_Crit_Chance = 8
  • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Level of Hawks Eye for Ranger_Caster[5]) Equal to 3
  • Then - Actions
  • Set Hawk_Eye_Bool = True
  • Set Ranger_Crit_Chance = 11
  • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Level of Hawks Eye for Ranger_Caster[5]) Equal to 4
  • Then - Actions
  • Set Hawk_Eye_Bool = True
  • Set Ranger_Crit_Chance = 14
Delete this part, use "Set Ranger_Crit_Chance = 2+(3xLevel of Scattershot of Ranger_Caster[5])" or something like that :D

Anyway, I can't find any leak in it... Is there any other triggers in the map? They may cause leaks (but to be honest, Warcraft 3 can cause lags without any idea :D)
 
Ha, i was too lazy to do that on the critical passive... But no, there are no other triggers causing leaks or whatsoever, i've checked every single one of them with leak checker. This is the only one that does that D:
 
Oh well, it seems it was because i instead of removing, killed the dummy units. so removing them solved the lag problem :O Solved.
 
Status
Not open for further replies.
Back
Top