HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

What is wrong with this trigger?

11-18-2003, 04:23 AM#1
FerretDruid
Code:
Not Working Trigger
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Casting unit) Equal to Dummyspellcaster 0000 <gen>
        (Ability being cast) Equal to DummySpell
        dummylvlvariable Equal to 1.00
    Actions
        Unit - Pause dummyspelltarget
        For each (Integer A) from 0 to 3, do (Actions)
            Loop - Actions
                Unit - Create 1 dummyunits[(Integer A)] for (Owner of Dummyspellcaster 0000 <gen>) at (Random point in (Region centered at (Position of dummyspelltarget) with size (300.00, 300.00))) facing (Position of dummyspelltarget)
                Unit Group - Add (Last created unit) to soontobedeaddummies
        Wait 1.00 seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (soontobedeaddummies is empty) Equal to False
            Then - Actions
                Unit Group - Pick every unit in (Random 1 units from soontobedeaddummies) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Attack dummyspelltarget
                        Unit - Add a 0.05 second Generic expiration timer to (Picked unit)
                        Unit Group - Remove (Picked created unit) from soontobedeaddummies
                        Wait 0.01 seconds
            Else - Actions
                Do nothing
        Unit - Unpause dummyspelltarget

Basically.. This is supposed to pick the first 4 units in the integer array variable (dummyunits) and then make them each attack one by one and poof. The way it is now, they are summoned, then they attack, and they won't poof. They are Workers so I know they aren't just autoaquiring the nearest target, the attack part works but the expiration timer doesn't. I figure there's at least a couple things wrong throughout the entire trigger but I am clueless atm to what they are :(
11-18-2003, 05:00 AM#2
FF_Behemoth
Quote:
Originally posted by FerretDruid
Code:
Not Working Trigger
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Casting unit) Equal to Dummyspellcaster 0000 <gen>
        (Ability being cast) Equal to DummySpell
        dummylvlvariable Equal to 1.00
    Actions
        Unit - Pause dummyspelltarget
        For each (Integer A) from 0 to 3, do (Actions)
            Loop - Actions
                Unit - Create 1 dummyunits[(Integer A)] for (Owner of Dummyspellcaster 0000 <gen>) at (Random point in (Region centered at (Position of dummyspelltarget) with size (300.00, 300.00))) facing (Position of dummyspelltarget)
                Set Dummyunit[(Integer A)] = (Last created unit)
                Unit - Order Dummyunit[(Integer A)] to Attack dummyspelltarget
                Unit - Add a 1.00 second Generic expiration timer to Dummyunit[(Integer A)]
            Else do -
                 Do nothing
      Wait xxx gametime secs
      Unit - Unpause dummyspelltarget


Try this....
11-18-2003, 05:34 AM#3
FerretDruid
I couldn't reproduce your code... There was an "Else" but not an "If / Then" so this is how I wrote it:

Code:
Not Working Trigger
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Casting unit) Equal to Dummyspellcaster 0000 <gen>
        (Ability being cast) Equal to Dummyspell
        dummylvlvariable Equal to 1.00
    Actions
        Wait 1.00 seconds <- I based spell on FrostNova so I need to put this Wait here or the unit will have "Slowed" buff tip in portrait window while paused
        Unit - Pause dummyspelltarget
        For each (Integer A) from 0 to 3, do (Actions)
            Loop - Actions
                Unit - Create 1 dummyunits[(Integer A)] for (Owner of Dummyspellcaster 0000 <gen>) at (Random point in (Region centered at (Position of dummyspelltarget) with size (300.00, 300.00))) facing (Position of dummyspelltarget)
                Set Dummyunit[(Integer A)] = (Last created unit)
                Unit - Order Dummyunit[(Integer A)] to Attack dummyspelltarget
                Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                Wait 1.00 seconds
        Unit - Unpause dummyspelltarget

So, with it that way - unit is paused and one by one dummyunits appear, attack, and poof. It's good that they poof but, I need them to be Created simultaneously. Sorry if I was unclear about that in my first post ;) Created simultanteously, but attack / poof in random sequence one by one.
11-18-2003, 06:50 AM#4
FF_Behemoth
sorry I accidently left the else do nothing action. I quoted from your post after all.

1 error I noticed in your trigger Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
It should be Unit - Add a 1.00 second Generic expiration timer to Dummyunit[(integer A)]

If you still dont like that then I guess you have to do the long way

A- Unit - Create 1 dummyunits[(Integer A)] for (Owner of Dummyspellcaster 0000 <gen> ) at (Random point in (Region centered at (Position of dummyspelltarget blah blah
A- set Dummyunit[0] = last created unit
Unit - Add a 1.00 second Generic expiration timer to Dummyunit[0]
Unit - Create 1 dummyunits[(Integer A)] for (Owner of Dummyspellcaster 0000 <gen> ) at (Random point in (Region centered at (Position of dummyspelltarget blah blah
A- set Dummunit[1] = last created unit
Unit - Add a 1.00 second Generic expiration timer to Dummyunit[1]
---repeat create dummunit [2][3], setting variable dummunits[2][3], and adding expieation timer[2][3]---
Unit - Order Dummyunit[0] to Attack dummyspelltarget
wait xxx gametime secs
Unit - Order Dummyunit[1] to Attack dummyspelltarget
wait xxx gametime secs
---etc....---
11-18-2003, 07:05 AM#5
FerretDruid
Hm, I was worried about that. I've found there is usually a way to do those kind of things in a loop action, which I figured I could use for this also.

Like I tried to do - place 4 units form the array and add each to a new variable, then do a loop action for them in the new variable. I don't understand why that doesn't work?
11-18-2003, 12:43 PM#6
Biflspud
Can I offer a simple solution?

If the dummy units aren't used for anything else, give them 2 hit points, and set their life regeneration to -1. They'll drop dead in 1 second.

As for ordering the units, you already have a region centered around the caster. Just do

Unit Group - Order units in region matching (unit type = dummyunit) to attack target.
11-18-2003, 08:16 PM#7
FerretDruid
I suppose that would work, I was just looking for a way to clean up my triggers. They get pretty nasty when I have to use a specific chain of actions for each unit-type (there is a total of 12 different units being created, not just 12 different versions of the same unit).