Trigger Execution Problem

MorbazanRhot

New Member
Reaction score
7
I have a pretty simple question. Why isn't the Loop executing more than once when I cast this spell (I've tried changing the number to 2, and to something based off of the level of the spell, but regardless it always runs just once and ends)? +rep for anything that helps me fix this.

Trigger:
  • Dark
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dark
    • Actions
      • Set TempLoc9 = (Target point of ability being cast)
      • Set TempLoc10 = (Target point of ability being cast)
      • Special Effect - Create a special effect at TempLoc9 using Abilities\Spells\Other\Drain\DrainCaster.mdl
      • Set SpecialEffect[1] = (Last created special effect)
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Wait 1.00 game-time seconds
          • Special Effect - Create a special effect at TempLoc10 using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Create 1 Dummy for (Owner of TheChanneler) at TempLoc9 facing Default building facing (270.0) degrees
          • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
          • Unit - Add Dark(dummy) to (Last created unit)
          • Unit - Set level of Dark(dummy) for (Last created unit) to (Level of Dark for (Triggering unit))
          • Set GroupVar4 = (Units within 900.00 of TempLoc9 matching ((((Owner of (Matching unit)) is an enemy of (Triggering player)) Equal to True) and (((Matching unit) is alive) Equal to True)))
          • Set UnitVarPicked2 = (Random unit from GroupVar4)
          • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning UnitVarPicked2
          • Custom script: call DestroyGroup (udg_GroupVar4)
      • Special Effect - Destroy SpecialEffect[1]
      • Custom script: call RemoveLocation (udg_TempLoc9)
      • Custom script: call RemoveLocation (udg_TempLoc10)
 

MorbazanRhot

New Member
Reaction score
7
Alright, first I tried moving the wait until the end of the Loop, still experienced the same problem. Then I removed it entirely and it worked fine. The thing is, in order for the spell to function the way I'd like that wait really is crucial. I could switch it to 2 separate triggers and use another Every 1 Second of Game-time trigger but I'd really prefer to not do that if I don't have to (and quite frankly, I can't see anything in this trigger that the wait is screwing up). So can anyone tell me what's getting screwed up by the wait? Or possibly any way to fix this without making another separate trigger?
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
590
# Custom script: call DestroyGroup (udg_GroupVar4)
You attempt to reuse something dead. You never destroy globals, I suggest clearing the group though.
 

MorbazanRhot

New Member
Reaction score
7
I'm not quite sure what you're saying? I've tried the trigger without the Custom Script line in the Loop and it still only runs once (which would be bad anyway, because the unit group would leak?). And I've used that line to clear groups before and never had a problem using them again.

Like I said, I probably just don't understand what you're saying, sorry.
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
You may not destroy an unexisting group. The variable itself still exists, but it has no value, so basically you're destroying an unexisting group and the function stops, because whenever something goes wrong the function stops.
 

MorbazanRhot

New Member
Reaction score
7
But if I remove that line (Custom script: call DestroyGroup (udg_GroupVar4)) from the Loop it still only executes once (provided the wait still exists). So how does that relate?
 

Exide

I am amazingly focused right now!
Reaction score
448
How do you know that it only runs once?
Add a message saying 'Success!' inside the loop, and see how many times the message appear.

-Make sure that the cooldown on the Chain lightning spell that your dummy is supposed to cast is something like 0.01.
-Don't remove the Custom script: call DestroyGroup(udg_GroupVar4) action.
-Do remove TempLoc10, and use TempLoc9 instead.

EDIT: Change this
Trigger:
  • Set GroupVar4 = (Units within 900.00 of TempLoc9 matching ((((Owner of (Matching unit)) is an enemy of (Triggering player)) Equal to True) and (((Matching unit) is alive) Equal to True)))


into:

Trigger:
  • Set GroupVar4 = (Units within 900.00 of TempLoc9 matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))


(Triggering Player) = (Owner of (Triggering Unit))
 

MorbazanRhot

New Member
Reaction score
7
Tried the text method of testing the number of times it runs, only ran once. Fixed the Triggering Player mistake, but it didn't actually fix the trigger. Also cut down to 1 point variable. So I'm still stumped.

Is it possible there could be something else in the map affecting how this trigger runs (these variables are only used in this trigger though, I originally used replaceable ones but gave this trigger its own when it wouldn't work properly)?
 

Exide

I am amazingly focused right now!
Reaction score
448
The only thing I can think of is that you're looping something else at the same time.
-Try using an Integer that is specially created for this loop.

You can also upload your map, if you don't mind.
 

MorbazanRhot

New Member
Reaction score
7
Thank you so much! There must be something else looping at the same time (although as of right now, I'm not quite sure what) because giving it its own variable solved the problem (and that makes sense with the wait being the problem too). Already gave you and everyone else that helped out +rep a while ago. Thanks again.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top