• 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 Locust Swarm

Status
Not open for further replies.
Level 8
Joined
Oct 6, 2022
Messages
185
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
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
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

  • Kill Locusts Near Enemies.w3m
    17.8 KB · Views: 2
Status
Not open for further replies.
Top