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

[Solved] Check If a Worker Is Constructing a Building?

Status
Not open for further replies.
Level 21
Joined
May 29, 2013
Messages
1,567
I'm using a triggered no target ability that allows two worker units of the same type to permanently merge into a single unit.

I need condition(s) that would check if another nearby worker is currently constructing a building to prevent it from being paired with the casting worker. I'm not sure if it matters, but the workers are using the Peon/Wisp type of construction, i.e. they build from the inside of the building.
 
Level 21
Joined
May 29, 2013
Messages
1,567
maybe you could put them into a unitgroup while the are constructing and remove them once they are finished/construction is cancelled. and then just check if they are part of that unitgroup
How would I do that? I don't even know how to get the worker. It seems like I can only get the building in GUI.

I was really hoping there would be an easier solution, like checking if the worker's current order is equal to 'build' or something like that.

EDIT: I solved it like this:
  • And - All (Conditions) are true
    • Conditions
      • (Current order of TempUnit) Not equal to (Order(o003))
      • (Current order of TempUnit) Not Equal to (Order(o00A))
      • (Current order of TempUnit) Not equal to (Order(o008))
      • (Current order of TempUnit) Not equal to (Order(o002))
      • (Current order of TempUnit) Not equal to (Order(o006))
      • (Current order of TempUnit) Not equal to (Order(o00C))
      • (Current order of TempUnit) Not equal to (Order(o00B))
      • (Current order of TempUnit) Not equal to (Order(o009))
      • (Current order of TempUnit) Not equal to (Order(h002))
      • (Current order of TempUnit) Not equal to (Order(o007))
The orders are raw data ids of all the buildings the worker can build.
 
Last edited:
But is current order not "repair", after started? At least it's what i noted down in docu here back then.

JASS:
/*
        Default build mechanics:
    
            Human:

                1. Worker gets point order with id of BuildingType.
                2. When worker starts constructing the building it gets the "repair" order towards the building.
                3. When receiving the "repair" order it starts the spell "Repair" towards the building.
                
            Orc:
        
                1. Worker gets point order with id of BuildingType.
                2. < no more orders >
            
            Night Elves:
        
                1. Worker gets point order with id of BuildingType.
                2. < no more orders >
            
            Undead:
        
                1. Worker gets point order with id of BuildingType.
                2. < no more orders >
 
Level 21
Joined
May 29, 2013
Messages
1,567
But is current order not "repair", after started?
I think that's only the case with Human workers.

Off topic, but kinda related:

The 'Stats - Race' field supposedly determines which build ability the worker has:
ANbu - Build (Neutral)
AHbu - Build (Human)
AObu - Build (Orc)
AEbu - Build (Night Elf)
AUbu - Build (Undead)
AGbu - Build (Naga)

Orc, Naga and Neutral build appear to be completely the same. I don't know if all of them are used or do all workers that don't belong to the main 4 races also use the 'Build (Orc)', similar to how 'Afir' aka 'On Fire' ability from the 'Other' folder is unused and 'Afih' aka 'On Fire (Human)' is used instead in all mechanical units that don't belong to the main 4 races .

From their names I can assume which race has which build ability, but what about None, Commoner, Demon, etc.? I made a trigger that checks if the selected unit has one of the build abilities and if so, shows a floating text above it, but they are all considered to be the same; for example if I check if a unit has 'AHbu' aka 'Build (Human)', the floating text should only appear when I select workers from the Human folder (Peasants and Blood Elf Workers), but it also appears when I select any other worker unit (Acolyte, Wisp, Peon, Mur'gul Slave, Draenei Laborer). So, is there a way to check which build ability is used by which race?
 
Status
Not open for further replies.
Top