• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Spell] About Locust Swarm

Level 7
Joined
Oct 6, 2022
Messages
146
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 65
Joined
Aug 10, 2018
Messages
6,716
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: 0
Top