Detect when a unit comes near?

X-maul

AKA: Demtrod
Reaction score
201
How can I make an ability that will make the unit spawn an egg that will hatch when an enemy unit comes within 1.5 range and release 4 Zerglings?
I got the egg spawning fixed, but I cant figure out how to make it hatch when a unit comes near /:
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
I would add a behavior to the egg that has a periodic search effect. The search filters limits it to an enemy unit and it takes a maximum of 1 target in a 1.5 range. It would apply some effect to the target that triggers the hatching that you want.

If you hatch it through triggers you could do the same thing and use the event "Effect used" to know when the hatch effect is ran.
 

Dave312

Censored for your safe viewing
Reaction score
269
As far as getting the egg to hatch, look at the Zerg Building Dies behaviour (either the 6 or 9 version) which spawns Broodlings when certain zerg buildings die. I would use a similar behaviour and give it to your egg unit. Then when an enemy unit gets close (using the method Siretu suggested) just deal fatal damage to your egg (see the Timed Life Fate damage effect).
 

X-maul

AKA: Demtrod
Reaction score
201
Thank you guys :) I finished the spell and it works like a charm :) Now I just need to figure out some actors :) (sigh.. the learning proces is a pain in the a**)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top