• 🏆 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 an unit with locust

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
By Passing it to the RemoveUnit function.

You probably should store it somewhere, like in a group, unit variable or hashtable so you can access it on demand.

Be aware that locust units are ignored for area unit enums, but are included for player unit enums.
 
Essentially this is what I'm struggling with. I can't get it to detect the dummy units.


  • Vision Extension
    • Events
      • Unit - A unit Changes owner
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Relic
    • Actions
      • Set Relic_A = (Position of (Triggering unit))
      • Set Relic_Units = (Units within 4000.00 of Relic_A matching (((Unit-type of (Matching unit)) Equal to Dummy (Relic Vision)) and ((Owner of (Matching unit)) Not equal to (Owner of (Ownership-changed unit)))))
      • Unit Group - Pick every unit in Relic_Units and do (Unit - Remove (Picked unit) from the game)
      • Unit - Create 1 Dummy (Relic Vision) for (Owner of (Ownership-changed unit)) at (Relic_A offset by (0.00, 1000.00)) facing Default building facing degrees
      • Unit - Create 1 Dummy (Relic Vision) for (Owner of (Ownership-changed unit)) at (Relic_A offset by (750.00, 750.00)) facing Default building facing degrees
      • Unit - Create 1 Dummy (Relic Vision) for (Owner of (Ownership-changed unit)) at (Relic_A offset by (1000.00, 0.00)) facing Default building facing degrees
      • Unit - Create 1 Dummy (Relic Vision) for (Owner of (Ownership-changed unit)) at (Relic_A offset by (750.00, -750.00)) facing Default building facing degrees
      • Unit - Create 1 Dummy (Relic Vision) for (Owner of (Ownership-changed unit)) at (Relic_A offset by (0.00, -1000.00)) facing Default building facing degrees
      • Unit - Create 1 Dummy (Relic Vision) for (Owner of (Ownership-changed unit)) at (Relic_A offset by (-750.00, -750.00)) facing Default building facing degrees
      • Unit - Create 1 Dummy (Relic Vision) for (Owner of (Ownership-changed unit)) at (Relic_A offset by (-1000.00, 0.00)) facing Default building facing degrees
      • Unit - Create 1 Dummy (Relic Vision) for (Owner of (Ownership-changed unit)) at (Relic_A offset by (-750.00, 750.00)) facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Relic_A)
      • Custom script: call DestroyGroup(udg_Relic_Units)
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
first, do not add the locust ability in the object editor, add it in the trigger...then do this...

JASS:
call UnitAddAbility(udg_DUMMY, 'Aloc')
call ShowUnit(udg_DUMMY, false)
call call UnitRemoveAbility(udg_DUMMY, 'Aloc')
call ShowUnit(udg_DUMMY, true)

this will remove the locust ability, then you can pick the dummy and remove it, if you're using GUI, you can simply copy the code via custom scripts...
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_ID = GetHandleId(GetTriggerUnit())
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Unit - Remove (Load (Integer A) of ID in Tower_Hash) from the game
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 1 of ID in Tower_Hash
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 2 of ID in Tower_Hash
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 3 of ID in Tower_Hash
Remember to get rid of the leaks.
 
Well I think I'm not describing this well enough. This is working in conjunction with that other trigger you helped me with. When the Relic unit changes owners from passive to player it will create the 8 dummy units to extend sight range. When it changes again it should remove the current dummies and create new ones for the new owner.
 
My knowledge on hashtables is limited. As of now I have 8 units created in a circle at map initialization and stored as such:

  • Vision Extension
    • Events
    • Conditions
    • Actions
      • Unit - Create 1 Dummy (Relic Vision) for Neutral Passive at (Relic_A offset by (0.00, 1000.00)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 1 of 8 in Tower_Hash_Units
      • Unit - Create 1 Dummy (Relic Vision) for Neutral Passive at (Relic_A offset by (750.00, 750.00)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 2 of 8 in Tower_Hash_Units
      • Unit - Create 1 Dummy (Relic Vision) for Neutral Passive at (Relic_A offset by (1000.00, 0.00)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 3 of 8 in Tower_Hash_Units
      • Unit - Create 1 Dummy (Relic Vision) for Neutral Passive at (Relic_A offset by (750.00, -750.00)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 4 of 8 in Tower_Hash_Units
      • Unit - Create 1 Dummy (Relic Vision) for Neutral Passive at (Relic_A offset by (0.00, -1000.00)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 5 of 8 in Tower_Hash_Units
      • Unit - Create 1 Dummy (Relic Vision) for Neutral Passive at (Relic_A offset by (-750.00, -750.00)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 6 of 8 in Tower_Hash_Units
      • Unit - Create 1 Dummy (Relic Vision) for Neutral Passive at (Relic_A offset by (-1000.00, 0.00)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 7 of 8 in Tower_Hash_Units
      • Unit - Create 1 Dummy (Relic Vision) for Neutral Passive at (Relic_A offset by (-750.00, 750.00)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 8 of 8 in Tower_Hash_Units
 
Status
Not open for further replies.
Top