• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How to swap one building with another?

Status
Not open for further replies.
Level 5
Joined
Feb 27, 2009
Messages
115
Bizarrely, I haven't figured out a solution to the simple problem of swapping one building out with another. As for units, it is easily done. But buildings? I can't get it to work.

I'm trying to change the towers based on someone's research. So if you research Y, the towers go from guard towers to something like cannon towers.

I have tried the direct approach of Replace Unit to each of the towers. But the game ignores this.

I have been successful in making it change with this type of trigger:

Event: Unit (X Tower) comes in 9999999 range of another unit (some indestructible I have in the map)

Condition: Whatever

Action: Replace Triggering Unit with Y Tower.

This trigger only works when the map initializes. However, if I turn it on later it does not work. Why? I have no idea.

I have no idea what DOES work which is very frustrating.

Do you have any ideas? What trigger should I be using to swap buildings in mid-game?
 
Level 2
Joined
Mar 9, 2009
Messages
21
You could just remove your old, lets say guard, tower and create a new cannon tower at the place of the removed unit. Just store the guard towers in a unit group (don't forget to fix the leaks) and pick / remove them. Then you create a cannon tower at the point where the picked unit was removed from the game.
Again, don't forget to fix the leaks.
 
Level 4
Joined
Apr 14, 2009
Messages
118
Wait didnt you say it was based on someone's research?
Do you mean like blacksmith researching or anything like that? because you can do that in the object editor.
 
Level 4
Joined
Aug 30, 2009
Messages
70
Of course it changes only at initialization because it first has to leave the range and get in again before the trigger starts again.

And when you say you turned it on again i think you used this
  • Trigger
    • Trigger - Turn on (This trigger)
but you should use
  • Trigger
    • Trigger - Run (This trigger)
or you could just do
  • Untitled Trigger 001
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to ...
    • Actions
      • Unit Group - Pick every unit in (Units of type ...) and do (Actions)
        • Loop - Actions
          • ...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,208
As they research the technology, remove all old towers and at their positions make new ones. This will work so do not bother saying it does not (if it does not you must be messing something up). Remember that if your towers are hidden or have the locust ability they will be ignored by some enums and so not added to a group.

Alternitivly, using the chaos ability and the technologies used by the seige engine, you should be able to get it to automatically do what you want without the needs for any triggers.
 
Level 5
Joined
Feb 27, 2009
Messages
115
Man, I can't believe it was that simple. OK, I got it working through the unit group action of picking units.

But what type of leaks are there with this command? Does picking units leave behind some sort of points behind?
 
Level 5
Joined
Nov 22, 2009
Messages
181
Why not just upgrade the towers directly? For example, set the the building the guard tower upgrades into to cannon tower and set the tech tree requirements. Then do this:
  • Upgrade towers
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Improved Masonry
    • Actions
      • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Guard Tower) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to train/upgrade to a Cannon Tower
or something similar.
 
Status
Not open for further replies.
Top