• 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.

Help me spot leaks.

Status
Not open for further replies.
Level 16
Joined
Oct 17, 2009
Messages
1,579
  • Throw Dagger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Throw Dagger
    • Actions
      • Set Point2 = (Position of (Triggering unit))
      • Set Point3 = (Target point of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Int8 Less than or equal to 1
        • Then - Actions
          • Set Point = ((Position of (Triggering unit)) offset by 850.00 towards (Angle from Point2 to Point3) degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Int Equal to 50
            • Then - Actions
              • Set Int = 0
            • Else - Actions
              • Set Int = (Int + 1)
          • Unit - Create 1 Dagger for Player 1 (Red) at Point2 facing (Facing of (Triggering unit)) degrees
          • Unit - Order (Last created unit) to Move To Point
          • Set Unit_Array[Int] = (Last created unit)
          • Set Real2[Int] = 2.25
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Int8 Equal to 2
            • Then - Actions
              • Set Real = ((Angle from Point2 to Point3) - 50.00)
              • For each (Integer A) from 1 to 10, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Int Greater than or equal to 50
                    • Then - Actions
                      • Set Int = 0
                    • Else - Actions
                      • Set Int = (Int + 1)
                  • Set Real = (Real + 10.00)
                  • Set Point = ((Position of (Triggering unit)) offset by 850.00 towards Real degrees)
                  • Unit - Create 1 Dagger for Player 1 (Red) at Point2 facing (Facing of (Triggering unit)) degrees
                  • Unit - Order (Last created unit) to Move To Point
                  • Set Unit_Array[Int] = (Last created unit)
                  • Set Real2[Int] = 2.00
                  • Custom script: call RemoveLocation(udg_Point)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Int8 Equal to 3
                • Then - Actions
                  • Unit - Create 1 Dummy for Player 1 (Red) at Point3 facing (Angle from Point2 to Point3) degrees
                  • Unit - Add a 8.00 second Generic expiration timer to (Last created unit)
                  • Unit Group - Add (Last created unit) to Unit_Group
                  • Unit - Add Throw Dagger to (Last created unit)
                  • Unit - Create 1 Portal for Player 1 (Red) at Point3 facing Default building facing degrees
                  • Unit - Add a 8.00 second Generic expiration timer to (Last created unit)
                • Else - Actions
      • Custom script: call RemoveLocation(udg_Point)
      • Custom script: call RemoveLocation(udg_Point2)
      • Custom script: call RemoveLocation(udg_Point3)
  • Throw Dagger Level 3
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Unit_Group and do (Actions)
        • Loop - Actions
          • Set Point5 = (Random point in (Region centered at (Position of (Picked unit)) with size (300.00, 300.00)))
          • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave Point5
          • Custom script: call RemoveLocation(udg_Point5)
  • Dagger Hit
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Int3) from 1 to Int, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Real2[Int3] Greater than 0.00
            • Then - Actions
              • Set Real2[Int3] = (Real2[Int3] - 0.03)
              • Unit Group - Pick every unit in (Units within 70.00 of (Position of Unit_Array[Int3])) 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 Player 1 (Red)) Equal to True
                    • Then - Actions
                      • Unit - Cause Unit_Array[Int3] to damage (Picked unit), dealing (Random real number between (38.00 + ((Real((Level of Throw Dagger for Unit))) x 12.00)) and (68.00 + ((Real((Level of Throw Dagger for Unit))) x 12.00))) damage of attack type Hero and damage type Normal
                      • Unit Group - Remove (Picked unit) from (Last created unit group)
                      • Unit - Remove Unit_Array[Int3] from the game
                      • Set Real2[Int3] = 0.00
                    • Else - Actions
            • Else - Actions
              • Unit - Remove Unit_Array[Int3] from the game
              • Set Real2[Int3] = 0.00
When I cast a 3rd level "Throw Dagger", it would create a dummy at the target point of ability being cast and orders it to cast a 1st level "Throw Dagger" at random places at an interval of .25 seconds for 8 seconds and now my problem is after a few seconds, the game would lag. I'm pretty sure it has something to do with leaks or maybe I'm just wrong and my pc is just that slow, but if it's leaks that are causing the problem then I need help spotting them as I'm not really that good at these kinds of things.
 
First trigger can be fixed a lot first action shoud be
Set Caster = Casting Unit
then
Set Point2 = Position of Caster
and u should add this
Set Angle = Angle between points Point2 to Point3
and huge if/then/else actions can make game very laggy
Then this action
Set Point = ((Position of (Triggering unit)) offset by 850.00 towards (Angle from Point2 to Point3) degrees) should be like this
Set Point = Point2 offset by 850.00 towards Angle(upper variable) degrees)
also this action Unit - Create 1 Dagger for Player 1 (Red) at Point2 facing (Facing of (Triggering unit)) degrees should be
Unit - Create 1 Dagger for Player 1 (Red) at Point2 facing Angle degrees
this also should be Set Real = ((Angle from Point2 to Point3) - 50.00) fixed to Set Real = Angle - 50.00)
Set Point = ((Position of (Triggering unit)) offset by 850.00 towards Real degrees) this should be like Set Point = Point2 offset by 850.00 towards Real degrees)
etc else is based on this mistakes
 
Level 2
Joined
May 21, 2012
Messages
13
Can you post the current version please?

Also I advise you to use timers instead of the 'every x seconds'
Also why do you use a rec? I don't know, but I always had my problems with them, why not use units in range of x matching y?
 
  • Dagger Hit
  • Events
  • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
  • For each (Integer Int3) from 1 to Int, do (Actions)
  • Loop - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • Real2[Int3] Greater than 0.00
  • Then - Actions
  • Set Real2[Int3] = (Real2[Int3] - 0.03)
  • -------- Action For Unit Group Change Like This -------->
  • [U]Set UnitGroup10 = (Units within 70.00 of (Position of Unit_Array[Int3])) matching Conditions ((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True[/U]
  • Unit Group - Pick every unit in [U]UnitGroup10[/U] and do (Actions)
  • Loop - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • Delete Condition
  • Then - Actions
  • Unit - Cause Unit_Array[Int3] to damage (Picked unit), dealing (Random real number between (38.00 + ((Real((Level of Throw Dagger for Unit))) x 12.00)) and (68.00 + ((Real((Level of Throw Dagger for Unit))) x 12.00))) damage of attack type Hero and damage type Normal
  • Unit Group - Remove (Picked unit) from (Last created unit group) - delete this and Make it like this :
  • [U]call DestroyGroup(udg_UnitGroup10)[/U]
  • Unit - Remove Unit_Array[Int3] from the game
  • Set Real2[Int3] = 0.00
  • Else - Actions
  • Else - Actions
  • Unit - Remove Unit_Array[Int3] from the game
  • Set Real2[Int3] = 0.00
 
Status
Not open for further replies.
Top