• 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] Spell Leaking

Status
Not open for further replies.
Level 2
Joined
Feb 11, 2010
Messages
33
  • Frozen Start Effect
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Frozen Sphere
    • Actions
      • Set Frozen_Caster = (Triggering unit)
      • Set Frozen_Position = (Target point of ability being cast)
      • Set Frozen_CasterPosition = (Position of Frozen_Caster)
      • Unit - Create 1 Frozen Sphere for (Owner of Frozen_Caster) at (Position of Frozen_Caster) facing (Facing of Frozen_Caster) degrees
      • Set Frozen_Sphere = (Last created unit)
      • Unit - Add Frozen Slow to Frozen_Sphere
      • Set Frozen_MaxDistance = (Distance between (Position of Frozen_Caster) and Frozen_Position)
      • Set Frozen_SlowGroup = (Units within 0.00 of (Position of Frozen_Caster) matching (((Matching unit) belongs to an enemy of (Owner of Frozen_Caster)) Equal to True))
      • Trigger - Turn on Frozen Loop <gen>
[hidden="Frozen Loop]
  • Frozen Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set Frozen_Distance = (Distance between (Position of Frozen_Sphere) and Frozen_CasterPosition)
      • Set Frozen_Move = ((Position of Frozen_Sphere) offset by 20.00 towards (Angle from (Position of Frozen_Sphere) to Frozen_Position) degrees)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Frozen_Distance Less than Frozen_MaxDistance
        • Then - Actions
          • Set Frozen_NonDamagedGroup = (Units within 150.00 of (Position of Frozen_Sphere) matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is in Frozen_SlowGroup) Equal to False) and (((Matching unit) belongs to an
          • Unit Group - Pick every unit in Frozen_NonDamagedGroup and do (Actions)
            • Loop - Actions
              • Unit Group - Add (Picked unit) to Frozen_SlowGroup
              • Unit - Cause Frozen_Caster to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
              • Unit - Order Frozen_Sphere to Human Sorceress - Slow (Picked unit)
          • Unit - Move Frozen_Sphere instantly to Frozen_Move
          • Custom script: call RemoveLocation(udg_Frozen_Move)
          • Custom script: call DestroyGroup(udg_Frozen_NonDamagedGroup)
        • Else - Actions
          • For each (Integer A) from 1 to 36, do (Actions)
            • Loop - Actions
              • Set Frozen_Effect1 = ((Position of Frozen_Sphere) offset by 75.00 towards (10.00 x (Real((Integer A)))) degrees)
              • Set Frozen_Effect2 = ((Position of Frozen_Sphere) offset by 150.00 towards (10.00 x (Real((Integer A)))) degrees)
              • Unit - Create 1 Frozen Sphere for Player 1 (Red) at Frozen_Effect1 facing Default building facing degrees
              • Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
              • Unit - Create 1 Frozen Sphere for Player 1 (Red) at Frozen_Effect2 facing Default building facing degrees
              • Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
          • Unit - Add a 0.01 second Generic expiration timer to Frozen_Sphere
          • Custom script: call RemoveLocation(udg_Frozen_Effect1)
          • Custom script: call RemoveLocation(udg_Frozen_Effect2)
          • Custom script: call RemoveLocation(udg_Frozen_Position)
          • Custom script: call RemoveLocation(udg_Frozen_CasterPosition)
          • Custom script: call DestroyGroup(udg_Frozen_SlowGroup)
          • Trigger - Turn off (This trigger)
[/hidden]

So i think(pretty sure) that the Frozen_SlowGroups leaks but i dont know how to make it works...After 2 cast it lags like hell , anyone help =D

SO THIS IS SOLVED , THX Spinnaker
 
Last edited:
Start trigger:

You set position of casting unit to:
  • Set Frozen_CasterPosition = (Position of Frozen_Caster)
And you do not use it at all creating thus lot of leaks are created just at the start. Make use of that point while creating group & unit and for calculating the distance.
Remember to remove the location at the end of trigger via:
  • Custom script: call RemoveLocation(udg_Frozen_CasterPosition)
Loop trigger:
Again, position leaks, but now you haven't even set the point type variable to it. Instead of:
  • Set Frozen_Distance = (Distance between (Position of Frozen_Sphere) and Frozen_CasterPosition)
  • Set Frozen_Move = ((Position of Frozen_Sphere) offset by 20.00 towards (Angle from (Position of Frozen_Sphere) to Frozen_Position) degrees
Do:
  • Set Frozen_Sphere_Loc = (Position of Frozen_Sphere)
  • Set Frozen_Move = (Frozen_Sphere_Loc offset by 20.00 towards (Angle from Frozen_Sphere_Loc to Frozen_Position)
  • Set Frozen_Distance = (Distance between Frozen_Sphere_Loc and Frozen_CasterPosition)
Use the Frozen_Sphere_Loc also while creating Frozen_NonDamagedGroup group and when calculating both effects positions. The last thing I would mention is that you should replace units with effects, because I can see that those are creates only for visual purpose ;)

Instead of:
  • Unit - Create 1 Frozen Sphere for Player 1 (Red) at Frozen_Effect1 facing Default building facing degrees
  • Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
Use:
  • Special Effect - Create a special effect at Frozen_Effect1 using "<here you write path of model - effect that you want to use>"
  • Special Effect - Destroy (Last created special effect)
Repeat twice, since you wish to create two effects at two differend locations.
Additionaly, you dont remove leaks properly, the remove/destroy function should be on the same 'level' and the one that sets it. 'bj_wantDestroyGroup = true' could be here usefull too. Fixed loop:

  • Frozen Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set Frozen_Sphere_Loc = (Position of Frozen_Sphere)
      • Set Frozen_Move = (Frozen_Sphere_Loc offset by 20.00 towards (Angle from Frozen_Sphere_Loc to Frozen_Position)
      • Set Frozen_Distance = (Distance between Frozen_Sphere_Loc and Frozen_CasterPosition)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Frozen_Distance Less than Frozen_MaxDistance
        • Then - Actions
          • Unit - Move Frozen_Sphere instantly to Frozen_Move
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 150.00 of Frozen_Sphere_Loc matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is in Frozen_SlowGroup) Equal to False) and (((Matching unit) belongs to an and do (Actions)
            • Loop - Actions
              • Unit Group - Add (Picked unit) to Frozen_SlowGroup
              • Unit - Cause Frozen_Caster to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
              • Unit - Order Frozen_Sphere to Human Sorceress - Slow (Picked unit)
        • Else - Actions
          • For each (Integer A) from 1 to 36, do (Actions)
            • Loop - Actions
              • Set Frozen_Effect1 = (Frozen_Sphere_Loc offset by 75.00 towards (10.00 x (Real((Integer A)))) degrees)
              • Set Frozen_Effect2 = (Frozen_Sphere_Loc offset by 150.00 towards (10.00 x (Real((Integer A)))) degrees)
              • Unit - Create 1 Frozen Sphere for Player 1 (Red) at Frozen_Effect1 facing Default building facing degrees
              • Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
              • Unit - Create 1 Frozen Sphere for Player 1 (Red) at Frozen_Effect2 facing Default building facing degrees
              • Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
              • Unit - Add a 0.01 second Generic expiration timer to Frozen_Sphere
              • Custom script: call RemoveLocation(udg_Frozen_Effect1)
              • Custom script: call RemoveLocation(udg_Frozen_Effect2)
              • Custom script: call RemoveLocation(udg_Frozen_Position)
              • Custom script: call RemoveLocation(udg_Frozen_CasterPosition)
              • Custom script: call DestroyGroup(udg_Frozen_SlowGroup)
              • Trigger - Turn off (This trigger)
      • Custom script: call RemoveLocation(udg_Frozen_Sphere_Loc)
      • Custom script: call RemoveLocation(udg_Frozen_Move)
RRemember though that instead of checking constant locations for distance you could set real variable as the initial distance from starting point to destination one and later in loop refer to that real reducing it each time loop runs - makes your life easier and gets rid of few location variables, since now you are runing with 6 o_O
 
Last edited:
Level 2
Joined
Feb 11, 2010
Messages
33
MAN , A BIG THX FOR U , this as just pissing me off =0
well i noticed my error and learned a few beter things , thx =D
 
Status
Not open for further replies.
Top