• 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.

GUI: Removing Dummy units

Status
Not open for further replies.
Level 5
Joined
Sep 1, 2010
Messages
168
[solved] GUI: Removing Dummy units

EDIT: SOLVED

Hi folks!
Currently I'm stuck with a problem concerning dummy units:
For a unit in my tower defense, I use a dummy unit for the unit's "second" attack. So far, so good. Unfortunately, I cannot remove the dummy unit when the tower is sold or destroyed, same problem with exchanging the dummy when upgrading the original unit.

Has someone here an idea on how to remove a dummy unit after creation, when you didn't add an expiration timer to it?

I'm not using custom values on the non-creep units, so I'm kinda limited in my options here.
To make things worse, I'm still a lousy GUI user, so implementing any JASS is out of the question atm.

+rep and mentioning in credits is what I can offer for your help - and a big big thanksalot :)

First version of the map should be able to be downloaded soon, since this concerns one of the 2 last towers and after that I mainly have to reduce leaks a bit more..
 
Last edited:
You need a hashtable for that:
  • Tr1
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Hashtable - Create a hashtable
    • Set Hash = (Last Created Hashtable)
  • Tr
  • Events
    • Unit - A unit finishes construction
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to X
  • Actions
    • Set Point1 = (Position of (Triggering unit))
    • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Point1 facing Default building facing degrees
    • Hashtable - Save (Last Created unit) as 0 of (Key(Triggering unit)) in Hash
    • Custom script: call RemoveLocation (udg_Point1)
Loading part, killing the dummy:
  • Trig1
  • Events
    • Unit - A unit dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to X (the construction)
  • Actions
    • Unit - Kill (Load 0 of (Key(Triggering unit)) from Hash)
    • Hashtable - Clear all child hashtables of child (Key(Triggering unit)) in Hash
 
Status
Not open for further replies.
Top