does this leak?

Status
Not open for further replies.
Level 7
Joined
Jun 15, 2010
Messages
218
  • arcane explosion
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Arcane Explosion
    • Actions
      • Set positie_ArcaneExplosion = (Position of (Triggering unit))
      • Unit - Create 1 Dummy (arcane explosion) for (Owner of (Triggering unit)) at positie_ArcaneExplosion facing Default building facing degrees
      • Unit - Add a 1.20 second Generic expiration timer to (Last created unit)
      • Animation - Change (Last created unit)'s size to ((75.00 + ((Real((Level of Arcane Explosion for (Triggering unit)))) x 25.00))%, (75.00 + (25.00 x (Real((Level of Arcane Explosion for (Triggering unit))))))%, (75.00 + (25.00 x (Real((Level of Arcane Explosion for (Triggering unit))))))%) of its original size
      • Unit Group - Pick every unit in (Units within (275.00 + (45.00 x (Real((Level of Arcane Explosion for (Triggering unit)))))) of positie_ArcaneExplosion matching (((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (75.00 x (Real((Level of Arcane Explosion for (Triggering unit))))) damage of attack type Spells and damage type Magic
      • Sound - Play WindSerpentMissile <gen> at 100.00% volume, attached to (Triggering unit)
      • Sound - Destroy (Last played sound)
      • Custom script: call RemoveLocation(udg_positie_ArcaneExplosion)


Is there any leak here?
 
Before the Unit Group - Pick units action, use the custom script:
  • Custom script: set bj_wantDestroyGroup = true
Your Unit Group pick is wrong; when you match units, you need to use (Matching unit):
  • Unit Group - Pick every unit in (Units within (275.00 + (45.00 x (Real((Level of Arcane Explosion for (Triggering unit)))))) of positie_ArcaneExplosion matching (((Matching unit) belongs to an enemy of (O
 
Something small, but:
  • Sound - Play WindSerpentMissile <gen> at 100.00% volume, attached to (Triggering unit)
  • Sound - Destroy (Last played sound)
When you do that, the sound won't play. WindSerpentMissile <gen> is a generated global, which is generated on initialization as a sound file. Whenever you do Sound - Play <sound> at <volume> attached to <unit>, it won't create a new sound, it will play an existing one. (the one you specified) That basically means that you should remove the destroy, otherwise it won't play and won't work for the rest of the map until you recreate it. :) It should just be this:
  • Sound - Play WindSerpentMissile <gen> at 100.00% volume, attached to (Triggering unit)
EDIT: @defskull: Yep. You are going to reuse it again, so if you destroy it then it won't work. Leaks = unneeded memory, you still need the sound. :)
 
Last edited:
Level 7
Joined
Jun 15, 2010
Messages
218
thanks all im getting better and better at leaks:)..
So i should never use " unit begins casting an ability? "
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
thanks all im getting better and better at leaks:)..
So i should never use " unit begins casting an ability? "

Unit begins casting an ability does not leak.

Why you should use starts the effect is that when that triggers, mana cost and cooldown take place. With "begins casting", you can press the ability icon and then quickly order the unit to stop. The trigger fires and stuff happens but no mana is drained and there will be no cooldown.

Begins casting fires about 0.3 - 0.5 seconds before starts the effect, the delay is defined by the casting unit's cast point value.

So yes, you can use begins casting, but you need to know why spesifically you are using it.
 
Status
Not open for further replies.
Top