• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

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