• 🏆 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!

Picking and Removing Units

Status
Not open for further replies.
Level 8
Joined
Mar 3, 2009
Messages
327
In my map I'm having a lot of trouble removing a lot of locusted units with
  • Round
    • Events
      • Player - Player 1 (Red) types a chat message containing -round as An exact match
    • Conditions
    • Actions
      • Set tempgroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in tempgroup and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
          • Game - Display to (All players) the text: (String((Number of units in tempgroup)))
          • Game - Display to (All players) the text: derp
      • Custom script: call DestroyGroup(udg_tempgroup)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Unit - Create 1 Engine for (Player((Integer A))) at ((Player((Integer A))) start location) facing (Center of (Playable map area))
              • Set Engine[(Integer A)] = (Last created unit)
            • Else - Actions
I am aware of the center of playable map area leak. I, honestly, do not care.


The other units get removed by this fine, but my mass of locust units does not. Do you guys have any tips? Do you want me to upload the map..?
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

Well locust units are unpickable at all but you can do this as far as I know:

1) Whenever you create a unit with locust, directly add them into another unit group [LastCreatedUnit]
Now you can pick all units in this unitgroup and "Kill" them (Remove unit is a leak btw)

2) When the locust units are already on the map, remove the locust ability from them (Object Editor)
Now you make at initialization a function where you pick up all units which should have locust, add them into the unitgroup and use this custom script:
  • Custom script: call UnitAddAbility(GetEnumUnit(),'Aloc')
Now the units have locust again, are added in this unitgroup and can be removed from there.

Also "(Units in (Playable map area))" isn't a leak here, because you store it in a point ;) but "((Player((Integer A))) start location)" is a leak ;)
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
Well locust units are unpickable at all...

Both of these will display the number of units, even if they have locust :)
  • Game - Display to Player Group - Player 1 (Red) the text: (String((Number of units in (Units owned by Player 12 (Brown)))))
  • Game - Display to Player Group - Player 1 (Red) the text: (String((Number of units in (Units of type Footman))))
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Both of these will display the number of units, even if they have locust :)
  • Game - Display to Player Group - Player 1 (Red) the text: (String((Number of units in (Units owned by Player 12 (Brown)))))
  • Game - Display to Player Group - Player 1 (Red) the text: (String((Number of units in (Units of type Footman))))

Leaks two unit groups.
 
Level 19
Joined
Oct 15, 2008
Messages
3,231
Or making it have more health/mana than other units would usually have and use the "Real - Unit Max Life Is Equal To" condition.
 
Status
Not open for further replies.
Top