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

[Trigger] how to remove this leak?

Status
Not open for further replies.
Level 4
Joined
Aug 3, 2011
Messages
222
There's a Effect Spamming...

  • Bloody Wolf skill 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Wolf Clap
    • Actions
      • For each (Integer A) from 1 to 360, do (Actions)
        • Loop - Actions
          • Set Wolf_Clap[(Integer A)] = ((Position of (Triggering unit)) offset by 150.00 towards (Real((Integer A))) degrees)
      • For each (Integer B) from 1 to 360, do (Actions)
        • Loop - Actions
          • Special Effect - Create a special effect at Wolf_Clap[(Integer B)] using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
          • Special Effect - Destroy (Last created special effect)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
1) You're not fixing all location leaks (you're creating 360 of them each time the ability is cast, as you do not remove "Position of (Triggering Unit)").
2) Do not use an array to fix this, you can all combine it into 1 loop.
3) Do not loop to 360. That's an overabundance of effects.

  • Actions
    • Set tempLoc1 = (Position of (Triggering unit))
    • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • Set tempLoc2 = (tempLoc1 offset by 150.00 towards (30.00 x (Real((Integer A)))) degrees)
        • Special Effect - Create a special effect at tempLoc2 using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
        • Special Effect - Destroy (Last created special effect)
        • Custom script: call RemoveLocation( udg_tempLoc2 )
    • Custom script: call RemoveLocation( udg_tempLoc1 )
This fixes the leaks + shows a reasonable amount of effects (12 instead of 360).
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
To get the value of "30.00" from apo's trigger, here's the formula;
360 / numberOfSpecialEffect

For example you want 6 SFX to be created circling a location, so each degree will be;
360 / 6 = 60

So, each SFX will be spawned 60 degrees spaced out to each other.
 
Status
Not open for further replies.
Top