• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Fixing Leaks

Status
Not open for further replies.
Level 4
Joined
Aug 22, 2008
Messages
100
I need help fixing leaks in this spell (it gets very laggy after a while:pnewt:).
Im not so advanced in trigger leaks so you will probably have to explain alot.
Thanks in advance.:psmile:

The Casting:
  • Ring of Fire
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ring of Fire
    • Actions
      • Trigger - Turn on Ring of Fire Loop <gen>
      • Set CasterRingofFire = (Casting unit)
      • Wait (10.00 + (2.00 x (Real((Level of Ring of Fire for (Casting unit)))))) seconds
      • For each (Integer A) from 0 to Specialffectringoffirecount, do (Actions)
        • Loop - Actions
          • Special Effect - Destroy RingofFireSpecialEffect[(Integer A)]
      • Set Specialffectringoffirecount = 0
      • Trigger - Turn off Ring of Fire Loop <gen>
The Loop:
  • Ring of Fire Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DegreesRingofFire Greater than or equal to 350.00
        • Then - Actions
          • Set DegreesRingofFire = 0.00
          • Unit Group - Remove all units of AlreadyHitRingofFire from AlreadyHitRingofFire
        • Else - Actions
          • Set DegreesRingofFire = (DegreesRingofFire + 10.00)
      • Special Effect - Create a special effect at ((Position of CasterRingofFire) offset by 400.00 towards DegreesRingofFire degrees) using Objects\Spawnmodels\Human\FragmentationShards\FragBoomSpawn.mdl
      • Set RingofFireSpecialEffect[Specialffectringoffirecount] = (Last created special effect)
      • Set Specialffectringoffirecount = (Specialffectringoffirecount + 1)
      • Unit Group - Pick every unit in (Units within 75.00 of ((Position of CasterRingofFire) offset by 400.00 towards DegreesRingofFire degrees) matching (((Matching unit) is in AlreadyHitRingofFire) Equal to False)) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to AlreadyHitRingofFire
          • Unit - Cause CasterRingofFire to damage (Picked unit), dealing (15.00 x (Real((Level of Ring of Fire for CasterRingofFire)))) damage of attack type Spells and damage type Fire
      • Destructible - Pick every destructible within 75.00 of ((Position of CasterRingofFire) offset by 400.00 towards DegreesRingofFire degrees) and do (Actions)
        • Loop - Actions
          • Destructible - Kill (Picked destructible)
      • Unit - Cause CasterRingofFire to damage circular area after 0.00 seconds of radius 75.00 at ((Position of CasterRingofFire) offset by 400.00 towards DegreesRingofFire degrees), dealing (5.00 x (Real((Level of Ring of Fire for CasterRingofFire)))) damage of attack type Spells and damage type Fire
 
1) 0.02 is a really low loop. Use 0.04 - 0.05.

2)
  • Special Effect - Create a special effect at ((Position of CasterRingofFire) offset by 400.00 towards DegreesRingofFire degrees) using Objects\Spawnmodels\Human\FragmentationShards\FragBoomSpawn.mdl
Should be:
  • Set Points[1] = (Position of CasterRingofFire)
  • Set Points[2] = (Points[1] offset by 400.00 towards DegreesRingofFire degrees)
  • Special Effect - Create a special effect at Points[2] using Objects\Spawnmodels\Human\FragmentationShards\FragBoomSpawn.mdl
  • Special Effect - Destroy (Last created special effect)
  • Custom script: call RemoveLocation (udg_Points[1])
  • Custom script: call RemoveLocation (udg_Points[2])
The model you are using for the special effect doesn't have a stand animation, so it can be destroyed instantly. Use the trigger actions above and remove the following lines:

  • For each (Integer A) from 0 to Specialffectringoffirecount, do (Actions)
    • Loop - Actions
      • Special Effect - Destroy RingofFireSpecialEffect[(Integer A)]
and
  • Set RingofFireSpecialEffect[Specialffectringoffirecount] = (Last created special effect)
    • Set Specialffectringoffirecount = (Specialffectringoffirecount + 1)
3)
  • Unit Group - Pick every unit in (Units within 75.00 of ((Position of CasterRingofFire) offset by 400.00 towards DegreesRingofFire degrees) matching (((Matching unit) is in AlreadyHitRingofFire) Equal to False)) and do (Actions)
    • Loop - Actions
Should be
  • Set Points[1] = (Position of CasterRingofFire)
  • Set Points[2] = (Points[1] offset by 400.00 towards DegreesRingofFire degrees)
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units within 75.00 of Points[2] matching (((Matching unit) is in AlreadyHitRingofFire) Equal to False)) and do (Actions)
    • Loop - Actions
  • Custom script: call RemoveLocation (udg_Points[1])
  • Custom script: call RemoveLocation (udg_Points[2])
4)
  • Destructible - Pick every destructible within 75.00 of ((Position of CasterRingofFire) offset by 400.00 towards DegreesRingofFire degrees) and do (Actions)
Again, you are leaking Points. By setting the points I've mentioned above, use them to refer with the Destructible pick.

5)
  • Unit - Cause CasterRingofFire to damage circular area after 0.00 seconds of radius 75.00 at ((Position of CasterRingofFire) offset by 400.00 towards DegreesRingofFire degrees), dealing (5.00 x (Real((Level of Ring of Fire for CasterRingofFire)))) damage of attack type Spells and damage type Fire
Again, Points[1] and Points[2] I've mentioned above.
 
Level 4
Joined
Aug 22, 2008
Messages
100
Is this correct?


  • Ring of Fire Loop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DegreesRingofFire Greater than or equal to 350.00
        • Then - Actions
          • Set DegreesRingofFire = 0.00
          • Unit Group - Remove all units of AlreadyHitRingofFire from AlreadyHitRingofFire
        • Else - Actions
          • Set DegreesRingofFire = (DegreesRingofFire + 10.00)
      • Set PointRingofFire[1] = (Position of CasterRingofFire)
      • Set PointRingofFire[2] = (PointRingofFire[1] offset by 400.00 towards DegreesRingofFire degrees)
      • Special Effect - Create a special effect at PointRingofFire[2] using Objects\Spawnmodels\Human\FragmentationShards\FragBoomSpawn.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation (udg_PointRingofFire[1])
      • Custom script: call RemoveLocation (udg_PointRingofFire[2])
      • Set PointRingofFire[1] = (Position of CasterRingofFire)
      • Set PointRingofFire[2] = (PointRingofFire[1] offset by 400.00 towards DegreesRingofFire degrees)
      • Unit Group - Pick every unit in (Units within 75.00 of PointRingofFire[2] matching (((Matching unit) is in AlreadyHitRingofFire) Equal to False)) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to AlreadyHitRingofFire
          • Unit - Cause CasterRingofFire to damage (Picked unit), dealing (15.00 x (Real((Level of Ring of Fire for CasterRingofFire)))) damage of attack type Spells and damage type Fire
      • Destructible - Pick every destructible within 75.00 of PointRingofFire[2] and do (Actions)
        • Loop - Actions
          • Destructible - Kill (Picked destructible)
      • Custom script: call RemoveLocation (udg_PointRingofFire[1])
      • Custom script: call RemoveLocation (udg_PointRingofFire[2])
 
You don't have to set the variables once again, since they refer to the same points. It should be like this:
  • Ring of Fire Loop
  • Events
    • Time - Every 0.04 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • DegreesRingofFire Greater than or equal to 350.00
      • Then - Actions
        • Set DegreesRingofFire = 0.00
        • Unit Group - Remove all units of AlreadyHitRingofFire from AlreadyHitRingofFire
      • Else - Actions
        • Set DegreesRingofFire = (DegreesRingofFire + 10.00)
        • Set PointRingofFire[1] = (Position of CasterRingofFire)
        • Set PointRingofFire[2] = (PointRingofFire[1] offset by 400.00 towards DegreesRingofFire degrees)
        • Special Effect - Create a special effect at PointRingofFire[2] using Objects\Spawnmodels\Human\FragmentationShards\FragBoomSpawn.mdl
        • Special Effect - Destroy (Last created special effect)
        • Custom script: set bj_wantDestroyGroup = true
        • Unit Group - Pick every unit in (Units within 75.00 of PointRingofFire[2] matching (((Matching unit) is in AlreadyHitRingofFire) Equal to False)) and do (Actions)
          • Loop - Actions
            • Unit Group - Add (Picked unit) to AlreadyHitRingofFire
            • Unit - Cause CasterRingofFire to damage (Picked unit), dealing (15.00 x (Real((Level of Ring of Fire for CasterRingofFire)))) damage of attack type Spells and damage type Fire
        • Destructible - Pick every destructible within 75.00 of PointRingofFire[2] and do (Actions)
          • Loop - Actions
            • Destructible - Kill (Picked destructible)
        • Custom script: call RemoveLocation (udg_PointRingofFire[1])
        • Custom script: call RemoveLocation (udg_PointRingofFire[2])
 
Status
Not open for further replies.
Top