• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

removing a unit with locust through trigger

Status
Not open for further replies.
Level 17
Joined
Aug 19, 2007
Messages
1,380
Hi all,

I use a dummy unit for an effect for a building, and I want to remove it as soon as the building is detroyed. I use this trigger for it:

  • Remove RCore Effect
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Nuclear Pylon
    • Actions
      • Set TEMP_PointRadiating2 = (Position of (Dying unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 25.00 of TEMP_PointRadiating2 matching ((Unit-type of (Matching unit)) Equal to Radiation)) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Custom script: call RemoveLocation(udg_TEMP_PointRadiating2)
This works. Except for when I give the unit the locust ability (in object editor), than the dummy locust unit does not get removed. Anyone know a solution? Thanks in advance!
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
You cannot pick locusts with any unit-groups that have to do with position (in range / in region).
You can, however, pick them with "Owned by player"-unit groups.

This will be able to pick a locust unit:
  • Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type Locust) and do (Actions)
    • Loop - Actions
You can still do a position check within the unit-group itself.
 
Level 17
Joined
Aug 19, 2007
Messages
1,380
Thanks guys for steering me the right way, it works perfectly now. For others who need it:

  • Remove RCore Effect
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Nuclear Pylon
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Owner of (Dying unit)) of type Radiation) and do (Actions)
        • Loop - Actions
          • Unit - Hide (Picked unit)
          • Custom script: call UnitRemoveAbility(GetEnumUnit(),'Aloc')
          • Unit - Unhide (Picked unit)
      • Set TEMP_PointRadiating2 = (Position of (Dying unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 25.00 of TEMP_PointRadiating2 matching ((Unit-type of (Matching unit)) Equal to Radiation)) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Custom script: call RemoveLocation(udg_TEMP_PointRadiating2)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Owner of (Dying unit)) of type Radiation) and do (Actions)
        • Loop - Actions
          • Custom script: call UnitAddAbility(GetEnumUnit(),'Aloc')
 
Status
Not open for further replies.
Top