Animating a building - help

†ALPHA†

New Member
Reaction score
3
I have a custom lumber mill model that's missing a proper work animation. I already tried transferring the original human lumber mill work anim but that didn't work. So I tried a group of triggers. Unfortunately because the triggers are rather inefficient the removal of the effect doesn't always work since the work anim isn't always the "last created effect"

Could you give me any help on how to make these triggers into one, efficient trigger?

Code:
LumberMillUpgradeBegin
    Events
        Unit - A unit Begins research
    Conditions
        (Unit-type of (Triggering unit)) Equal to Lumber Mill
    Actions
        Special Effect - Create a special effect attached to the first large of (Triggering unit) using Abilities\Spells\Items\HealingSalve\HealingSalveTarget.mdl

Code:
LumberMillUpgradeFinish
    Events
        Unit - A unit Finishes research
    Conditions
        (Unit-type of (Triggering unit)) Equal to Lumber Mill
    Actions
        Special Effect - Destroy (Last created special effect)

Code:
LumberMillUpgradeCancel
    Events
        Unit - A unit Cancels research
    Conditions
        (Unit-type of (Triggering unit)) Equal to Lumber Mill
    Actions
        Special Effect - Destroy (Last created special effect)

-EDIT-
I added variables in order to store the special effect. This prevents these triggers from interfering from other effects but if I happen to have TWO lumber mills...
Code:
Set LumberUpgrade = (Last created special effect)  //appended to end of LumberMillUpgradeBegin

Special Effect - Destroy LumberUpgrade  //replaces last line in LumberMillUpgradeFinish and LumberMillUpgradeCancel
 

†ALPHA†

New Member
Reaction score
3
-BUMP-
This is the current state of my triggers:

Code:
LumberMillUpgradeBegin
    Events
        Unit - A unit Begins research
    Conditions
        (Unit-type of (Triggering unit)) Equal to Lumber Mill
    Actions
        Special Effect - Create a special effect attached to the first large of (Triggering unit) using Abilities\Spells\Items\HealingSalve\HealingSalveTarget.mdl
        Set LumberUpgrade = (Last created special effect)

Code:
LumberMillUpgradeFinish
    Events
        Unit - A unit Finishes research
    Conditions
        (Unit-type of (Triggering unit)) Equal to Lumber Mill
    Actions
        Special Effect - Destroy LumberUpgrade

Code:
LumberMillUpgradeCancel
    Events
        Unit - A unit Cancels research
    Conditions
        (Unit-type of (Triggering unit)) Equal to Lumber Mill
    Actions
        Special Effect - Destroy LumberUpgrade
 

Azlier

Old World Ghost
Reaction score
461
I would suggest attaching the effect to the unit. You need an effect array and an integer variable...

Trigger:
  • Trig 1
    • Events
      • Unit - A unit Begins research
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (==) Lumber Mill
    • Actions
      • Special Effect - Create a special effect attached to the first large of (Triggering unit) using Abilities\Spells\Items\HealingSalve\HealingSalveTarget.mdl
      • Set LumberSFX[LumberIndex] = (Last created special effect)
      • Unit - Set the custom value of (Triggering unit) to LumberIndex
      • Set LumberIndex = (LumberIndex + 1)


Trigger:
  • Trig 2
    • Events
      • Unit - A unit Cancels research
      • Unit - A unit Finishes research
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (==) Lumber Mill
    • Actions
      • Special Effect - Destroy LumberSFX[(Custom value of (Triggering unit))]
 

†ALPHA†

New Member
Reaction score
3
Thanks azlier! It works great but there is one slight problem...
If the mill begins two different upgrades but then cancels one and continues with the other, the effect completely disappears. This isn't a big problem since I, and my friends, don't tend to ever cancel an upgrade.

If there's a way around that, I'd appreciate it! Thanks again! +rep
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top