HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unit Array Removal Bug

10-25-2003, 08:55 AM#1
Das Jank
So I have these 2 triggers that get run and are basicly the same but one works and the other doesnt and I can't figure out why.

This one does not work.
Code:
Ultra Ice Whirl Set 1
    Events
    Conditions
    Actions
        Unit - Create 1 Ultra Ice Whirl for (Owner of CasterOfFrostNova) at ((Position of FrostNovaTarget) offset by 300.00 towards 0.00 degrees) facing (Position of FrostNovaTarget)
        Set UltraIceUnitsArray[1] = (Last created unit)
        Unit - Create 1 Ultra Ice Whirl for (Owner of CasterOfFrostNova) at ((Position of FrostNovaTarget) offset by 300.00 towards 45.00 degrees) facing (Position of FrostNovaTarget)
        Set UltraIceUnitsArray[2] = (Last created unit)
        Unit - Create 1 Ultra Ice Whirl for (Owner of CasterOfFrostNova) at ((Position of FrostNovaTarget) offset by 300.00 towards 90.00 degrees) facing (Position of FrostNovaTarget)
        Set UltraIceUnitsArray[3] = (Last created unit)
        Unit - Create 1 Ultra Ice Whirl for (Owner of CasterOfFrostNova) at ((Position of FrostNovaTarget) offset by 300.00 towards 135.00 degrees) facing (Position of FrostNovaTarget)
        Set UltraIceUnitsArray[4] = (Last created unit)
        Unit - Create 1 Ultra Ice Whirl for (Owner of CasterOfFrostNova) at ((Position of FrostNovaTarget) offset by 300.00 towards 180.00 degrees) facing (Position of FrostNovaTarget)
        Set UltraIceUnitsArray[5] = (Last created unit)
        Unit - Create 1 Ultra Ice Whirl for (Owner of CasterOfFrostNova) at ((Position of FrostNovaTarget) offset by 300.00 towards 225.00 degrees) facing (Position of FrostNovaTarget)
        Set UltraIceUnitsArray[6] = (Last created unit)
        Unit - Create 1 Ultra Ice Whirl for (Owner of CasterOfFrostNova) at ((Position of FrostNovaTarget) offset by 300.00 towards 270.00 degrees) facing (Position of FrostNovaTarget)
        Set UltraIceUnitsArray[7] = (Last created unit)
        Unit - Create 1 Ultra Ice Whirl for (Owner of CasterOfFrostNova) at ((Position of FrostNovaTarget) offset by 300.00 towards 315.00 degrees) facing (Position of FrostNovaTarget)
        Set UltraIceUnitsArray[8] = (Last created unit)
        Wait 0.50 seconds
        For each (Integer A) from 1 to 8, do (Unit - Order UltraIceUnitsArray[(Integer A)] to Neutral - Firebolt FrostNovaTarget)
        Wait 1.00 seconds
        For each (Integer A) from 1 to 8, do (Unit - Remove UltraIceUnitsArray[(Integer A)] from the game)

And this one does work.
Code:
Ice Whirl Set 1
    Events
    Conditions
    Actions
        Unit - Create 1 Ice Whirl for (Owner of CasterOfFrostNova) at ((Position of FrostNovaTarget) offset by 300.00 towards 0.00 degrees) facing (Position of FrostNovaTarget)
        Set IceUnitsArray[1] = (Last created unit)
        Unit - Create 1 Ice Whirl for (Owner of CasterOfFrostNova) at ((Position of FrostNovaTarget) offset by 300.00 towards 90.00 degrees) facing (Position of FrostNovaTarget)
        Set IceUnitsArray[2] = (Last created unit)
        Unit - Create 1 Ice Whirl for (Owner of CasterOfFrostNova) at ((Position of FrostNovaTarget) offset by 300.00 towards 180.00 degrees) facing (Position of FrostNovaTarget)
        Set IceUnitsArray[3] = (Last created unit)
        Unit - Create 1 Ice Whirl for (Owner of CasterOfFrostNova) at ((Position of FrostNovaTarget) offset by 300.00 towards 270.00 degrees) facing (Position of FrostNovaTarget)
        Set IceUnitsArray[4] = (Last created unit)
        Wait 0.50 seconds
        For each (Integer A) from 1 to 4, do (Unit - Order IceUnitsArray[(Integer A)] to Neutral - Firebolt FrostNovaTarget)
        Wait 1.00 seconds
        For each (Integer A) from 1 to 4, do (Unit - Remove IceUnitsArray[(Integer A)] from the game)

Basicly the top one is not removing the units at the end of it. Why is this?
10-25-2003, 09:30 AM#2
Grater
I dunno why it wouldn't work (unless the array is getting used by another instance of the trigger during the waits)

A better way is to just give the units 1 second generic expiration timers, no waits required that way, and often no arrays either.
10-25-2003, 09:37 AM#3
ULTIMA_WEAPON_
i belive that there must be an event for it to work. Mech-Sheep taught me this.
10-25-2003, 09:48 AM#4
Grater
Okay heres an example I quickly threw together, hopefully you can learn from it. It looks like you want a 0.5 second delay before the casters cast, you should be able to set that as part of the "firebolt" spell, I think cast delay.
Quote:
Example
Events
Conditions
Actions
For each (Integer A) from 1 to 8, do (Actions)
Loop - Actions
Unit - Create 1 Flying Sheep for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 300.00 towards (45.00 x (Real((Integer A)))) degrees) facing Default building facing degrees
Unit Group - Order (Last created unit group) to Neutral - Firebolt Target
Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
10-25-2003, 05:40 PM#5
Das Jank
I could try that out but the odd thing is that the bottom one I posted does the same thing just with different units and a different array and it works. It removes the units at the end. When I have it run the top one it doesnt work though, all the units stay on the screen.
10-25-2003, 09:02 PM#6
jmoritz
Try using 4 units, and changing the units and spells to the one that does work. That way you can figure out if it fails because of the number of units, or the type of units.