[Spell] Having trouble with Advanced Build

Level 12
Joined
Apr 9, 2013
Messages
762
Hello, I wanted to make a smooth and fluid advanced build that wouldn't use 2 builders with morph ability. What I ended up with is a very smooth and easy enough trigger that disables/enables buildings, however I found it has one major flaw: it will cause previously queued up buildings to be disabled so peasant won't build anymore.

  • WEAdvBuild
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Ordered unit)) Equal to Peasant
    • Actions
      • -------- IF WORKER PRESSED "BUILD" OR "ADVANCED BUILD" --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(manashieldon))
              • (Issued order) Equal to (Order(manashieldoff))
        • Then - Actions
          • -------- Advanced Construction --------
          • Player - Make Settlement Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Inn Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Lumber Mill (WE) Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Blacksmith (WE) Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Farmhouse Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Thatched Cottage (1) Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Catholic Church Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Marketplace Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make University (WE) Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Cathedral Unavailable for training/construction by (Owner of (Ordered unit))
          • Player - Make Barracks Available for training/construction by (Owner of (Ordered unit))
          • Player - Make Archery Range Available for training/construction by (Owner of (Ordered unit))
          • Player - Make Stables Available for training/construction by (Owner of (Ordered unit))
          • Player - Make Siege Workshop Available for training/construction by (Owner of (Ordered unit))
          • Player - Make Scout Tower Available for training/construction by (Owner of (Ordered unit))
          • Player - Make Wooden Palisade (H) Available for training/construction by (Owner of (Ordered unit))
          • Player - Make Wooden Palisade (V) Available for training/construction by (Owner of (Ordered unit))
          • Player - Make Wooden Tower Available for training/construction by (Owner of (Ordered unit))
          • Player - Make Motte & Bailey (Castle Tier 1) Available for training/construction by (Owner of (Ordered unit))
          • Player - Make Build Plot (Worker) Available for training/construction by (Owner of (Ordered unit))
          • -------- FORCE "BUILD" KEY --------
          • Game - Force (Owner of (Ordered unit)) to press the key O.
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(windwalk))
            • Then - Actions
              • -------- Basic Construction --------
              • Player - Make Barracks Unavailable for training/construction by (Owner of (Ordered unit))
              • Player - Make Archery Range Unavailable for training/construction by (Owner of (Ordered unit))
              • Player - Make Stables Unavailable for training/construction by (Owner of (Ordered unit))
              • Player - Make Siege Workshop Unavailable for training/construction by (Owner of (Ordered unit))
              • Player - Make Scout Tower Unavailable for training/construction by (Owner of (Ordered unit))
              • Player - Make Wooden Palisade (H) Unavailable for training/construction by (Owner of (Ordered unit))
              • Player - Make Wooden Palisade (V) Unavailable for training/construction by (Owner of (Ordered unit))
              • Player - Make Wooden Tower Unavailable for training/construction by (Owner of (Ordered unit))
              • Player - Make Motte & Bailey (Castle Tier 1) Unavailable for training/construction by (Owner of (Ordered unit))
              • Player - Make Build Plot (Worker) Unavailable for training/construction by (Owner of (Ordered unit))
              • Player - Make Settlement Available for training/construction by (Owner of (Ordered unit))
              • Player - Make Inn Available for training/construction by (Owner of (Ordered unit))
              • Player - Make Lumber Mill (WE) Available for training/construction by (Owner of (Ordered unit))
              • Player - Make Blacksmith (WE) Available for training/construction by (Owner of (Ordered unit))
              • Player - Make Farmhouse Available for training/construction by (Owner of (Ordered unit))
              • Player - Make Thatched Cottage (1) Available for training/construction by (Owner of (Ordered unit))
              • Player - Make Catholic Church Available for training/construction by (Owner of (Ordered unit))
              • Player - Make Marketplace Available for training/construction by (Owner of (Ordered unit))
              • Player - Make University (WE) Available for training/construction by (Owner of (Ordered unit))
              • Player - Make Cathedral Available for training/construction by (Owner of (Ordered unit))
              • -------- FORCE "BUILD" KEY --------
              • Game - Force (Owner of (Ordered unit)) to press the key O.
            • Else - Actions
Does anyone have an idea how to salvage this without going to 2 peasants and morph ability?

Thank you.
 
Level 3
Joined
May 24, 2017
Messages
12
I created something, don't know if it is better.

I realized that if a unit has a building on its build list you can order it via triggers to build that building even if it's not in the UI display.

So I made a spellbook spell, created channel spells simulating the building icons that I wanted and put it on the spellbook.
When player click on the spell with the building icon, I give the unit a "build tiny" item spell with the corresponding building and force the player to press the hotkey for that spell.
This way you get a building shadow like you would if you were building a structure normally.
Once you pick a place and order that unit to use the build spell, I issue the order for that unit to build the corresponding building on the place of the order.
I looks very close to building normally, but you can't hold shift and build multiple structures with this approach...

It does solve the problem of canceling building for other units though and don't use morph. I'll attach the map file with the triggers and spells. Perhaps you can polish it and make it work.
 

Attachments

  • Test Advanced Building.w3m
    19.8 KB · Views: 1
Level 12
Joined
Apr 9, 2013
Messages
762
I created something, don't know if it is better.

I realized that if a unit has a building on its build list you can order it via triggers to build that building even if it's not in the UI display.

So I made a spellbook spell, created channel spells simulating the building icons that I wanted and put it on the spellbook.
When player click on the spell with the building icon, I give the unit a "build tiny" item spell with the corresponding building and force the player to press the hotkey for that spell.
This way you get a building shadow like you would if you were building a structure normally.
Once you pick a place and order that unit to use the build spell, I issue the order for that unit to build the corresponding building on the place of the order.
I looks very close to building normally, but you can't hold shift and build multiple structures with this approach...

It does solve the problem of canceling building for other units though and don't use morph. I'll attach the map file with the triggers and spells. Perhaps you can polish it and make it work.

Hello, thank you I will give it a try to polish it.
 
Level 12
Joined
Apr 9, 2013
Messages
762
Hello,

I have tried all these methods thoroughly
  • Morph Based Advanced Build : won't work since morphed units can not build (very old bug in wc3 engine)
  • Advanced Build based on disabling enabling buildings: you won't be able to queue buildings, overall buggy for multiplayer as when you order to build but the worker hasn't yet started building if you press the button it will disable buildings meaning the worker can not build the prior buildings.
  • Spell Book Advanced Build: not smooth, buggy, won't show prices.
Only way I haven't tried is with triggers that replace the unit once the button is pressed then forces the player to press hotkey to open build menu. But this runs in to the issue that you also need to issue trigger to reselect the unit. I am not able to do this trigger with my qualifications.
 
Level 25
Joined
Aug 29, 2012
Messages
1,082
I think that would work? It seems pretty straightforward

  • Unit - Replace (Triggering unit) with a Peasant (Advanced) using The old unit's life and mana
  • Selection - Select (Last replaced unit) for (Owner of (Last replaced unit))
Problem with replacing is that the peasant would lose all buffs/debuffs and any gold or lumber he carries, but it's probably the less troublesome method
 
Level 12
Joined
Apr 9, 2013
Messages
762
I think that would work? It seems pretty straightforward

  • Unit - Replace (Triggering unit) with a Peasant (Advanced) using The old unit's life and mana
  • Selection - Select (Last replaced unit) for (Owner of (Last replaced unit))
Problem with replacing is that the peasant would lose all buffs/debuffs and any gold or lumber he carries, but it's probably the less troublesome method
Hello, I tried this, but if you have selected 10 peasants, only one gets selected back instead of the whole group. Otherwise it seems to work.

  • WEAdvBuild Copy
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Ordered unit)) Equal to Peasant
          • (Unit-type of (Ordered unit)) Equal to Advanced Builder Peasant
    • Actions
      • -------- IF WORKER PRESSES ADVANCED BUILD --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(manashieldon))
              • (Issued order) Equal to (Order(manashieldoff))
        • Then - Actions
          • Unit - Replace (Triggering unit) with a Advanced Builder Peasant using The old unit's relative life and mana
          • Selection - Select (Last replaced unit) for (Owner of (Last replaced unit))
          • -------- FORCE "BUILD" KEY --------
          • Game - Force (Owner of (Ordered unit)) to press the key B.
        • Else - Actions
          • -------- IF WORKER PRESSES BASIC BUILD --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(windwalk))
            • Then - Actions
              • Unit - Replace (Triggering unit) with a Peasant using The old unit's relative life and mana
              • Selection - Select (Last replaced unit) for (Owner of (Last replaced unit))
              • -------- FORCE "BUILD" KEY --------
              • Game - Force (Owner of (Ordered unit)) to press the key B.
            • Else - Actions
 

Attachments

  • 1723215136530.png
    1723215136530.png
    48.2 KB · Views: 0
Level 12
Joined
Apr 9, 2013
Messages
762
I tried using Variables, it still doesn't keep selection of the unit group.
  • WEAdvBuild Copy
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Ordered unit)) Equal to Peasant
          • (Unit-type of (Ordered unit)) Equal to Advanced Builder Peasant
    • Actions
      • -------- IF WORKER PRESSES ADVANCED BUILD --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(manashieldon))
              • (Issued order) Equal to (Order(manashieldoff))
        • Then - Actions
          • Set VariableSet UnitsSelectedByPlayerX = (Units currently selected by (Owner of (Triggering unit)))
          • Unit - Replace (Triggering unit) with a Advanced Builder Peasant using The old unit's relative life and mana
          • Selection - Select UnitsSelectedByPlayerX for (Owner of (Triggering unit))
          • -------- FORCE "BUILD" KEY --------
          • Game - Force (Owner of (Ordered unit)) to press the key B.
        • Else - Actions
          • -------- IF WORKER PRESSES BASIC BUILD --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(windwalk))
            • Then - Actions
              • Set VariableSet UnitsSelectedByPlayerX = (Units currently selected by (Owner of (Triggering unit)))
              • Unit - Replace (Triggering unit) with a Peasant using The old unit's relative life and mana
              • Selection - Select UnitsSelectedByPlayerX for (Owner of (Triggering unit))
              • -------- FORCE "BUILD" KEY --------
              • Game - Force (Owner of (Ordered unit)) to press the key B.
            • Else - Actions
 
Level 3
Joined
May 24, 2017
Messages
12
It will add only last replaced unit, which out of a group would be only one.
It worked for me doing like this:

  • Build Advanced Structures
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Advanced Buildings
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by (Owner of (Casting unit))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Peasant
            • Then - Actions
              • Unit - Replace (Picked unit) with a Peasant Advanced using The old unit's relative life and mana
              • Selection - Add (Last replaced unit) to selection for (Owner of (Picked unit))
            • Else - Actions
              • Do nothing
      • Game - Force (Owner of (Casting unit)) to press the key b.
Remember that the skill has to be "Unique Cast", meaning only 1 unit from the selection will use it, or else the trigger will be played for each unit in the slection.
That's also why forcing the hotkey is out of the pick every unit event.

Also, make sure your worker has a higher priority than all the other units. Else, when you reselect them and have other types of unit in the selection, the workers will not be the first on the group and forcing the hotkey won't work.

I also forgot to adress leaking, so make sure to destroy the unit group too.
 
Top