• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Trigger question

Status
Not open for further replies.
Level 3
Joined
May 8, 2008
Messages
28
Here is my trigger. What I'm unsure of is what will happen if this trigger fires multiple times back to back. For example, Hero 1 triggers this and then 0.5 seconds later Hero 2 triggers it. The first run of the trigger, the timer is started expiring in two seconds to destroy the special effect. Will the second run of the trigger restart the timer before it is able to finish, causing a leak?

  • CompulsionLaborers
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) has an item of type Compulsion: Laborers) Equal to True
      • ((Killing unit) is A Hero) Equal to True
      • ((Unit-type of (Dying unit)) Equal to Farmer) or ((Unit-type of (Dying unit)) Equal to Merchant)
    • Actions
      • Set CompulsionRandom = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CompulsionRandom Greater than or equal to 50
        • Then - Actions
          • Player - Add 1 to (Owner of (Killing unit)) Current gold
          • Special Effect - Create a special effect attached to the overhead of (Killing unit) using Abilities\Spells\Other\Transmute\PileofGold.mdl
          • Set CompulsionSpecialEffect[0] = (Last created special effect)
          • Countdown Timer - Start CompulsionTimer[0] as a One-shot timer that will expire in 2.00 seconds
        • Else - Actions
  • CompulsionTimerExpireZero
    • Events
      • Time - CompulsionTimer[0] expires
    • Conditions
    • Actions
      • Special Effect - Destroy CompulsionSpecialEffect[0]
 
Level 6
Joined
Jun 4, 2017
Messages
172
Here is my trigger. What I'm unsure of is what will happen if this trigger fires multiple times back to back. For example, Hero 1 triggers this and then 0.5 seconds later Hero 2 triggers it. The first run of the trigger, the timer is started expiring in two seconds to destroy the special effect. Will the second run of the trigger restart the timer before it is able to finish, causing a leak?

  • CompulsionLaborers
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) has an item of type Compulsion: Laborers) Equal to True
      • ((Killing unit) is A Hero) Equal to True
      • ((Unit-type of (Dying unit)) Equal to Farmer) or ((Unit-type of (Dying unit)) Equal to Merchant)
    • Actions
      • Set CompulsionRandom = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CompulsionRandom Greater than or equal to 50
        • Then - Actions
          • Player - Add 1 to (Owner of (Killing unit)) Current gold
          • Special Effect - Create a special effect attached to the overhead of (Killing unit) using Abilities\Spells\Other\Transmute\PileofGold.mdl
          • Set CompulsionSpecialEffect[0] = (Last created special effect)
          • Countdown Timer - Start CompulsionTimer[0] as a One-shot timer that will expire in 2.00 seconds
        • Else - Actions
  • CompulsionTimerExpireZero
    • Events
      • Time - CompulsionTimer[0] expires
    • Conditions
    • Actions
      • Special Effect - Destroy CompulsionSpecialEffect[0]
I don't think this trigger is MUI so, if another hero activate the trigger in those 2 seconds the first special effect will probably become permanent. You can also put the "Destroy special effect" action right after you create it without using waits or timers. If you do that, the special effect will appear until the end of its animation and then it will be deleted.
 
Status
Not open for further replies.
Top