• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Spell] About Locust Swarm

Status
Not open for further replies.
Level 8
Joined
Oct 6, 2022
Messages
213
Hello Everyone, i would like to ask if it's possible to make a certain locust from locust swarm dies if it gets near from an enemy unit and how, Thanks in advance
 
So units with the Locust ability cannot be detected using Unit Groups like this:
  • Unit Group - Pick every unit within 500.00 range of some point
Instead, you'll need to manage them as they enter the map:
  • Detect Locust
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Locust
    • Actions
      • Unit Group - Add (Triggering unit) to LocustUnitGroup
      • Trigger - Turn on Kill Locust <gen>
Then periodically check for enemy units around them:
  • Kill Locust
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in LocustUnitGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet LocustUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (LocustUnit is alive) Equal to True
            • Then - Actions
              • Set VariableSet LocustPoint = (Position of LocustUnit)
              • Set VariableSet LocustTargetGroup = (Units within 100.00 of LocustPoint.)
              • Unit Group - Pick every unit in LocustTargetGroup and do (Actions)
                • Loop - Actions
                  • Set VariableSet LocustTarget = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (LocustUnit is alive) Equal to True
                      • (LocustTarget is alive) Equal to True
                      • (LocustTarget belongs to an enemy of (Owner of LocustUnit).) Equal to True
                    • Then - Actions
                      • Unit Group - Remove LocustUnit from LocustUnitGroup.
                      • Unit - Kill LocustUnit
                    • Else - Actions
              • Custom script: call RemoveLocation(udg_LocustPoint)
              • Custom script: call DestroyGroup(udg_LocustTargetGroup)
            • Else - Actions
              • Unit Group - Remove LocustUnit from LocustUnitGroup.
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in LocustUnitGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
vars.png
 

Attachments

Status
Not open for further replies.
Back
Top