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

Why does this leak?

Status
Not open for further replies.
Level 13
Joined
Jun 10, 2007
Messages
780
I've been doing GUI for 2 years, but I just started on advanced spells. Can someone tell me why this is leaking and not chainlightning everytime a new one spawns? And if you can, rewrite the trigger to correct it.

Thanks in advance.
  • Spark
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Spark
    • Actions
      • Unit - Create 1 Lightning Spark (Spark Dummy) for (Owner of (Triggering unit)) at (Target point of ability being cast) facing 0.00 degrees
      • Set Sphere[0] = (Last created unit)
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Set Spark_Group[1] = (Units within 850.00 of (Target point of ability being cast))
      • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Random unit from Spark_Group[1])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current order of (Triggering unit)) Equal to (Order(channel))
        • Then - Actions
          • Wait 2.00 seconds
          • If ((Current order of (Triggering unit)) Equal to (Order(channel))) then do (Trigger - Run Spark <gen> (checking conditions)) else do (Do nothing)
        • Else - Actions
          • Animation - Change Sphere[0]'s size to (0.00%, 0.00%, 0.00%) of its original size
          • Special Effect - Create a special effect at (Target point of ability being cast) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
Im using Channel as the base spell. It channels for 4 seconds in order for this trigger to loop 3 times. Sometimes, the chainlightnings don't happen 3 times, even though the unit is spawned.

+Rep for anyone who can address the whole issue and help me correct it!
 
Last edited:
Level 28
Joined
Mar 25, 2008
Messages
2,955
Uhmm if you set a variable to a unit, it's good to use it
  • Unit - Order Sphere[0] to
also i'd suggest to add an expiration timer to remove the casted dummy AND destroy the created special effect.
And last but not least, don't use advanced triggers ^.^they f*cked up half of my map
 
Level 9
Joined
Feb 19, 2006
Messages
115
First of all, what is Spark based off of? if its based on chain lightning, then there's no spell being channeled.
Also, what exactly is your spell supposed to do?
And, as a side note, don't use an expiration timer for the unit. Instead, set its HP to 10, and give it an HP regeneration rate of -5 (shift-click the field to enter negatives).
and as another side note, the line "Animation - Change Sphere[0]'s size to (0.00%, 0.00%, 0.00%) of its original size" is useless, because the unit is already dead.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
well you have a 2 second wait in there and you channel for 4 seconds. therefore it should only loop 2 times 4\2 = 2. i fyou channel for more than 4 seconds then it should loop the 3rd time

One at 0
One at 2
One at 4
That is not the problem. The problem is that waits are very inaccurate.
They can be up to 2 times longer that expected. The only way to be accurate in gui, is to use a periodic trigger or a countdown timer.
P.s. Also I am not sure that executing(running) the trigger in such a recursive manner would allow you to use the event responses. First time ok, but the second may cause issues.
 
Status
Not open for further replies.
Top