• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] How to remove builder after construction?

Status
Not open for further replies.
Level 3
Joined
Jun 9, 2010
Messages
31
Hey, was hoping you guys knew of a way to remove the builder after construction is finished, preferably in GUI. I haven't seen anything that refers to a "constructing unit," only "constructed building" and "casting unit" and so forth. The trigger's meant to be run several times (up to 8 times), as it's the end of a tutorial of a TD I'm making for my AP Comp Sci class. Thanks in advance, hopefully I'm just missing something. Here's what I have now:

  • Tower2
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • TutorialBoolean Equal to True
    • Actions
      • Unit - Remove (Triggering unit) from the game
Using "Remove (Triggering Unit) just removes the building as soon as its done. Removing the "Casting Unit" does nothing. Help?

Thanks,

~Brent
 
Last edited:
triggering unit should work, restart the editor. if it still bugs try this
  • trigger 1
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Set builder = (Triggering unit)
  • trigger 2
    • Events
      • Unit - A unit Cancels construction
    • Conditions
    • Actions
      • Set builder = No unit
  • trigger 3
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • check Equal to True
    • Actions
      • Unit - Remove builder from the game
 
Wow, I tried every possible solution to refer to the unit that construct the building but it seems it keep returns the unit of the building structure, not the builder...

Perhaps JASS has its own function call for this but not in GUI (or I just don't see it)

It's actually kinda funny; it's the one thing they left out in that list of event responses. That trigger list above looks like it might work.

Hey darkgrom, any ideas on how to do it if multiple people are building in a short amount of time? don't want the game to remove other people's builders.

I think if I did that, as soon as someone else started building while the first tower was still in construction, it will remove the second person's building, and not the first.

It's all a tutorial where every person has a spawned "tower builder." at the end they gotta build a tower, (each person) and I would remove the builder so I don't run into any issues with unit removal.
 
If it is a very spesific situation, the you can do it like this:

  • Untitled Trigger 003
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Farm
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Peasant) and ((Owner of (Triggering unit)) Equal to (Owner of (Matching unit))))) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
When a farm is constructed, it will remove all Peasants of that player.
 
Maker, I think the same way too but a little bit different instead picking all Peasants in that map, I just pick a small AOE around the finished construction and remove the Peasant/builder

But other problem will rise if I do it like that, you see, what if there is 2 Peasants around that finished construction ?

It will also remove the Peasants, therefore it looks kinda weird to have 2 missing Peasants instead of 1 (the constructor)


@Thread Starter
You were mentioning to present this trigger in your Computer Science class as part of your presentation, not part of a trigger for a game ?
Well, that will make things easier as you can pre-set the unit via set variable at the start game and so on, making it more easier rather than refer a unit which is generic
 
The way how the worker builds depends its race, it's hardcoded.

One day i've tried to make a GetWorker custom function, but it only really worked for not undead and human workers.
For humans because of the power building (several units can build the same structure), even if you still can play around that, but undeads are a nightmare, for some reason the builder keep the order for a moment (more than one second iirc), so it's quite innacurate.

If you really want this feature use build abilities would be more reliable.
 
If it is a very spesific situation, the you can do it like this:

  • Untitled Trigger 003
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Farm
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Peasant) and ((Owner of (Triggering unit)) Equal to (Owner of (Matching unit))))) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
When a farm is constructed, it will remove all Peasants of that player.

Worked! Thanks for the help. Instead of using the "units in playing field" here's what I did:

  • Tower2
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • TutorialBoolean Equal to True
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Tower Defender)) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
Thanks for the help, everyone.
 
Status
Not open for further replies.
Back
Top