• 🏆 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!

[Solved] Would this leak?

Status
Not open for further replies.
Level 6
Joined
Feb 22, 2009
Messages
212
Long story short, I am not confident with my eyes.

  • Bombardment
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Death from Above!!! (Common)
      • (Unit-type of (Triggering unit)) Equal to Rifleman (Sogat)
    • Actions
      • Set CastingUnit = (Casting unit)
      • Set CasterPoint = (Position of (Casting unit))
      • Set TargetPoint = (Target point of ability being cast)
      • Set AbilityPointArray[1] = (Random point in (Region centered at TargetPoint with size (300.00, 300.00)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of (Triggering unit)) Less than 20
        • Then - Actions
          • Set AnInteger = 6
        • Else - Actions
          • Set AnInteger = 14
      • For each (Integer A) from 1 to AnInteger, do (Actions)
        • Loop - Actions
          • Set MathOp[1] = (Angle from CasterPoint to TargetPoint)
          • Set AbilityPointArray[2] = (CasterPoint offset by -450.00 towards MathOp[1] degrees)
          • Unit - Create 1 Mortar Team for (Owner of (Triggering unit)) at AbilityPointArray[2] facing TargetPoint
          • Set AbilityPointArray[1] = (Random point in (Region centered at TargetPoint with size (300.00, 300.00)))
          • Unit - Set Base Damage of (Last created unit) to ((Base Damage of (Last created unit) for weapon index 1) + ((1000 x ((Level of Death from Above!!! (Common) for (Triggering unit)) - 1)) + ((Intelligence of CastingUnit (Include bonuses)) x 12))) for weapon index: 1
          • Unit - Set Dice Sides of (Last created unit) to ((Dice Sides of (Last created unit) for weapon index 1) + (Level of Death from Above!!! (Common) for CastingUnit)) for weapon index: 1
          • Unit - Order (Last created unit) to Attack Ground AbilityPointArray[1]
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation (udg_AbilityPointArray[1])
          • Custom script: call RemoveLocation (udg_AbilityPointArray[2])
      • Custom script: call RemoveLocation (udg_TargetPoint)
      • Custom script: call RemoveLocation (udg_CasterPoint)


  • Grom mirage
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoning unit)) Equal to Blademaster (Sogat)
      • (Unit-type of (Summoned unit)) Equal to Grom Mirage
    • Actions
      • Unit Group - Add (Summoned unit) to FinalWaveRemove
      • -------- ================================================= --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Bladestorm (Elite) for (Summoning unit)) Greater than or equal to 1
        • Then - Actions
          • Set AbilityArray[5] = Bladestorm (Elite)
          • Unit - Add AbilityArray[5] to (Summoned unit)
          • Unit - Set level of AbilityArray[5] for (Summoned unit) to (Level of AbilityArray[5] for (Summoning unit))
          • Unit - Order (Summoned unit) to Orc Blademaster - Bladestorm
        • Else - Actions
      • -------- ================================================= --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Intelligence of (Summoning unit) (Include bonuses)) Less than 25001
        • Then - Actions
          • Set RealArray[5] = ((Real((Intelligence of (Summoning unit) (Include bonuses)))) / 1000.00)
          • Set RealArray[6] = (RealArray[5] + 5.00)
        • Else - Actions
          • Set RealArray[6] = 30.00
      • Unit - Add a RealArray[6] second Generic expiration timer to (Summoned unit)
      • -------- ================================================= --------
      • Set CasterPoint = (Position of (Summoning unit))
      • Set TargetPoint = (Position of (Summoned unit))
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set MathOp[1] = ((Real((Integer A))) x 72.00)
          • Set AbilityPointArray[1] = (TargetPoint offset by 120.00 towards MathOp[1] degrees)
          • Unit - Create 1 Blademaster Mirage for (Owner of (Summoning unit)) at AbilityPointArray[1] facing TargetPoint
          • Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 0.00%) with 70.00% transparency
          • Unit - Set Base Damage of (Last created unit) to (Agility of (Summoning unit) (Include bonuses)) for weapon index: 1
          • Unit - Add a RealArray[6] second Generic expiration timer to (Last created unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Critical Strike (Common) for (Summoning unit)) Greater than or equal to 1
            • Then - Actions
              • Set AbilityArray[1] = Critical Strike (Common)
              • Unit - Add AbilityArray[1] to (Last created unit)
              • Unit - Set level of AbilityArray[1] for (Last created unit) to (Level of AbilityArray[1] for (Summoning unit))
            • Else - Actions
          • Unit - Order (Last created unit) to Attack-Move To TargetPoint
          • Custom script: call RemoveLocation (udg_AbilityPointArray[1])
      • Custom script: call RemoveLocation (udg_CasterPoint)
      • Custom script: call RemoveLocation (udg_TargetPoint)
      • -------- ================================================= --------
      • Animation - Change (Summoned unit)'s vertex coloring to (100.00%, 100.00%, 0.00%) with 70.00% transparency
      • Unit - Set Base Damage of (Summoned unit) to (Agility of (Summoning unit) (Include bonuses)) for weapon index: 1
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Critical Strike (Common) for (Summoning unit)) Greater than or equal to 1
        • Then - Actions
          • Set AbilityArray[1] = Critical Strike (Common)
          • Unit - Add AbilityArray[1] to (Summoned unit)
          • Unit - Set level of AbilityArray[1] for (Summoned unit) to (Level of AbilityArray[1] for (Summoning unit))
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
First trigger:
You're leaking AbilityPointArray[1] one time at the beginning of the trigger. It's being Set for no reason at all.

Use Polar Projection for AbilityPointArray[1].
  • Set AbilityPointArray[1] = (Center of TargetPoint Offset by Random Real between 0 and 300 towards Random Angle)
I believe "Region centered..." leaks the region it generates. I could be wrong though.

Careful that the Mortar Team doesn't set off the "A unit Enters region" Event of another trigger.

You should always be aware of the fact that in certain cases you can make other triggers run mid-execution of your current trigger. The actions of the other triggers will get inserted right after the "initial" action of your original trigger (the action that set off the other triggers). If these triggers use the same variables then there's a good chance that things will get mixed up and break. This goes beyond leaks, you'd probably notice your trigger just outright breaks when this happens.

Edit: I'm not 100% sure if this Event has this issue. It's only some Events that do this.

Second trigger:
Looks good to me.
 
Last edited:
Level 6
Joined
Feb 22, 2009
Messages
212
I believe "Region centered" leaks the region it generates. I could be wrong though.
Ah, Shit!

Careful that the Mortar Team doesn't set off the "A unit Enters region" Event of another trigger.
Wait. The mortar have "Locust". Are they still being selected by "A unit enters region"?
The actions of the other triggers will get inserted right after the "initial" action of your original trigger (the action that set off the other triggers). If these triggers use the same variables then there's a good chance that things will get mixed up and break. This goes beyond leaks, you'd probably notice your trigger just outright breaks when this happens.
So I need more variables? :(
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
My memory is failing me but I'm pretty certain Locust units DON'T "enter" regions. So you should be safe in that regard.

And you don't necessarily need a lot of variables. What I like to do is have specific variables for these Events:

A unit enters/leaves region -> Unique variables.
A unit dies -> Unique variables.
A unit casts an ability -> Unique variables (looks like you have these already).
A unit acquires/loses an item -> Unique variables.
A unit issues an order (no/point/target) -> Unique variables.

Maybe I'm forgetting some but this should cover just about everything. With this setup you don't have to worry about variables getting mixed up and causing issues.

However, remember that some Event Responses can get changed as well. For example, if a unit was ordered to summon a Water Elemental in the middle of your Grom mirage trigger, IF the unit didn't have any cast backswing/cast point (cast delay) then this could cause the Summoned/Summoning Event Responses to change to these new units. Then when your Grom trigger references the Summoned/Summoning units at the very end of it's Actions it will be referencing the Water Elemental/Whoever summoned it instead.

Triggering unit is an exception to this rule because it acts like a local variable that won't change throughout the trigger (it's even safe to use after Waits). There's all sorts of weird cases so instead of memorizing all of them I just like to be safe rather than sorry and use these unique variables. Again, things aren't very consistent with the World Editor, especially in GUI, so what I say may be true in SOME cases but not others.
 
Last edited:
Status
Not open for further replies.
Top