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

[Spell] About the wait function

Status
Not open for further replies.
Level 4
Joined
Jan 27, 2008
Messages
72
Hello fellas,

I've created a simple spell which involves placing a buff on a friendly unit, and when and if a hostile attacks this unit while it has the buff, it is put to sleep.

My concern about the spell as it is is that it is overpowered, since it is capable of putting an entire army to sleep if this army happens to focus target the unit with the buff.

The trigger looks like this:

  • Event: A unit is attacked
  • Condition: Triggering unit has buff called necrolepsy = true
  • Action: Create 1 dummy for owner of attacked unit
  • Action: add 1 sec generic expiration timer to last created unit
  • Action: order last created unit to sleep attacking unit
My question is, if I add a wait command at the end of this trigger, will the wait function stop the second attacking unit from being put to sleep?

For example,

An attacking unit gets put to sleep. This triggers the wait, and during this wait, any units that attack the buffed unit will not be put to sleep. Is this correct?
 
Level 11
Joined
May 8, 2009
Messages
275
No if you put a wait at the end of the trigger, nothing will change because if the unit is attacked, the trigger will fire again. What you have to do is to turn of the trigger and turn it back on after some time (adding "wait" and "turn this trigger on" at the end.
The problem is, if your have multiple units with the buff at the same time, it won't work and you'll have to add arrays, tell me if you know how to do it.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Instead of turning the trigger on/off, another method is to add (triggering unit) to a unit group.
Then wait X seconds and remove him from that unit group.

As condition, add "(Triggering unit) is in group equal to false".


Also, you can easily copy/paste a trigger by right-clicking the trigger name above "Events" and selecting "Copy as text".
Then you can paste it wherever you want.
 
Status
Not open for further replies.
Top