• 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.

Cooldown with triggers

Status
Not open for further replies.
Level 3
Joined
Sep 1, 2010
Messages
53
Hello, I have made a spell called Heart of Fire.
It works like this: Everytime the hero receives damage when his health is below 200, he transforms into a phoenix. How did I do this? With the storm crow ability, I made a trigger that whenever the attacked unit is attacked and his hit points are below 200, the "Storm Crow" ability is given to him and then removed instantly. He transforms because the "Normal Form" field on the ability is the phoenix. Alright then, the thing is that when the phoenix dies, the hero comes back with full hitpoints, but I need to make a cooldown to this spell so the hero won't transform everytime he receives damage below 200 hp! If you didn't understand tell me that I'll try to explain again!
 
Level 3
Joined
Sep 1, 2010
Messages
53
Alright, here is my trigger (there are 3)! Try to see if they are leakless!

Trigger 1 - Heart of Fire 1
  • Events
  • Unit - A unit Is attacked
  • Conditions
  • ((Unit-type of (Attacked unit)) Equal to Pyromaniac) and (HOF_Cooldown Equal to False)
  • Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Life of (Attacked Unit)) Less than or equal to 200.00
  • Then - Actions
  • Set Pyromaniac = (Attacked Unit)
  • Unit - Add Heart of Fire 2 to Pyromaniac
  • Unit - Remove Heart of Fire 2 from Pyromaniac
  • Set HOF_Duration = 60
  • Set HOF_Cooldown = True
  • Trigger - Turn on Heart of Fire 2 <gen>
  • Else - Actions
  • Do nothing
Trigger 2 - Heart of Fire 2
  • Events
  • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
  • If (All conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • HOF_Duration Greater than or equal to 1
  • Then - Actions
  • Set HOF_Duration = (HOF_Duration -1)
  • Else - Actions
  • Unit - Add Heart of Fire 3 to Pyromaniac
  • Unit - Remove Heart of Fire 3 from Pyromaniac
  • Unit - Set life of Pyromaniac to 500.00
  • Trigger - Turn on Heart of Fire 3 <gen>
  • Trigger - Turn off (This trigger)
Trigger 3 - Heart of Fire 3
  • Events
  • Conditions
  • Actions
  • Wait 180.00 seconds
  • Set HOF_Cooldown = False
  • Trigger - Turn off (This trigger)
That's what I got, the cooldown is supposed to start when the spell ends, I think it is all ok!
 
Status
Not open for further replies.
Top