HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Begin/Cancel/Finish Animation

10-22-2003, 05:22 AM#1
Panto
Greetings.

I'm trying to add the illusion of a "working" animation to a Nerubian Ziggurat.

I want the animation to play while the building is training, reviving a hero, or researching. Just concentrating on the training and researching aspects for the moment, I've made a trigger which is supposed to keep track of the number of researches or trainings in the building queue, and as long as it's greater than 0, have the special effect playing.

However, there's a hitch.
The "begins training" and "begins researching" triggers don't fire until the moment that the particular unit or research gets to the top of the queue and starts going. However, "cancels training" and "cancels research" fire at the very moment that you hit ESC or click the item on the queue to remove it. So, you could set three items to the queue, and then cancel two of them. Since the second and third items won't have fired the "begins" trigger yet, they won't have added to the number.
So, instead of 3-2, you end up with 1-2; understand?

So, my query is, how can I resolve this? There doesn't seem to be a condition that relates to the number of things in a building's queue, but the current system certainly does not work.

Recommendations?
10-22-2003, 09:29 PM#2
Ligature
Could you use "is issued an Order" instead of "begins researching?" It might fire right when you push the button.
10-22-2003, 10:39 PM#3
Panto
I'm not sure. I didn't think to try that out, but I did figure out a solution to the problem. I'll post them here.

There are many triggers, one each for the train, research, and revive "begins" and "cancels" commands, and one for all three "finish" commands.
Quote:
Code:
Ziggurat researching begins
    Events
        Unit - A unit Begins research
    Conditions
        (Race of (Owner of (Researching unit))) Equal to Orc
    Actions
        Set techArrayZigguratResearch[(Player number of (Owner of (Researching unit)))] = (Researched tech-type)
        -------- research = 1, training = 2, reviving = 3 --------
        Set intArrayTownHallEffect[(Player number of (Owner of (Researching unit)))] = 1
        Wait 0.50 game-time seconds
        Special Effect - Create a special effect attached to the origin of (Researching unit) using Abilities\Spells\Items\HealingSalve\HealingSalveTarget.mdl
        Set specialEffectArrayTownHall[(Player number of (Owner of (Researching unit)))] = (Last created special effect)
Quote:
Code:
Ziggurat researching cancels
    Events
        Unit - A unit Cancels research
    Conditions
        (Researched tech-type) Equal to techArrayZigguratResearch[(Player number of (Owner of (Researching unit)))]
        intArrayTownHallEffect[(Player number of (Owner of (Researching unit)))] Equal to 1
    Actions
        Special Effect - Destroy specialEffectArrayTownHall[(Player number of (Owner of (Researching unit)))]
Quote:
Code:
Ziggurat training begins
    Events
        Unit - A unit Begins training a unit
    Conditions
        (Race of (Owner of (Triggering unit))) Equal to Orc
    Actions
        Set unitArrayZigguratTraining[(Player number of (Owner of (Triggering unit)))] = (Unit-type of (Trained unit))
        -------- research = 1, training = 2, reviving = 3 --------
        Set intArrayTownHallEffect[(Player number of (Owner of (Triggering unit)))] = 2
        Wait 0.50 game-time seconds
        Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\HealingSalve\HealingSalveTarget.mdl
        Set specialEffectArrayTownHall[(Player number of (Owner of (Triggering unit)))] = (Last created special effect)
Quote:
Code:
Ziggurat training cancels
    Events
        Unit - A unit Cancels training a unit
    Conditions
        (Unit-type of (Trained unit)) Equal to unitArrayZigguratTraining[(Player number of (Owner of (Triggering unit)))]
        intArrayTownHallEffect[(Player number of (Owner of (Trained unit)))] Equal to 2
    Actions
        Special Effect - Destroy specialEffectArrayTownHall[(Player number of (Owner of (Trained unit)))]
Quote:
Code:
Ziggurat reviving begins
    Events
        Unit - A unit Begins reviving
    Conditions
        (Race of (Owner of (Reviving Hero))) Equal to Orc
    Actions
        Set unitArrayZigguratTraining[(Player number of (Owner of (Reviving Hero)))] = (Unit-type of (Reviving Hero))
        -------- research = 1, training = 2, reviving = 3 --------
        Set intArrayTownHallEffect[(Player number of (Owner of (Reviving Hero)))] = 3
        Wait 0.50 game-time seconds
        Unit Group - Pick every unit in (Units owned by (Owner of (Reviving Hero)) matching (((Matching unit) is A structure) Equal to True)) and do (Actions)
            Loop - Actions
                Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Items\HealingSalve\HealingSalveTarget.mdl
        Set specialEffectArrayTownHall[(Player number of (Owner of (Reviving Hero)))] = (Last created special effect)
Quote:
Code:
Ziggurat reviving cancels
    Events
        Unit - A unit Cancels reviving
    Conditions
        (Unit-type of (Reviving Hero)) Equal to unitArrayZigguratTraining[(Player number of (Owner of (Reviving Hero)))]
        intArrayTownHallEffect[(Player number of (Owner of (Reviving Hero)))] Equal to 3
    Actions
        Special Effect - Destroy specialEffectArrayTownHall[(Player number of (Owner of (Reviving Hero)))]
Quote:
Code:
Ziggurat finishes
    Events
        Unit - A unit Finishes research
        Unit - A unit Finishes training a unit
        Unit - A unit Finishes reviving
    Conditions
        (Race of (Owner of (Triggering unit))) Equal to Orc
    Actions
        Special Effect - Destroy specialEffectArrayTownHall[(Player number of (Owner of (Triggering unit)))]
These seven triggers work flawlessly. However, if you're playing in a map where there's more than one structure, you'll want to have slightly different conditions. Also, if your building can train normal units, the training trigger will be insufficient, because you can cancel units that are the same unit-type as the unit currently under production.

However, for my purposes, it's ridiculously flaw-free, and I'm very happy with it.