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

How can i make town centers upgrade to same tier?

Status
Not open for further replies.
Level 10
Joined
Sep 25, 2013
Messages
521
I'm creating a map that is supposed to be like the game Age of Mythology, but I have run into some difficulty with Town Centers. I want to make it so Town Centers you create all upgrade together to the same tier when you upgrade just one to the next tier. I tried this method:

Norse Keeps
Events
Unit - A unit Finishes an upgrade
Conditions
(Unit-type of (Triggering unit)) Equal to Keep
Actions
Sound - Play ClanInvitation <gen>
Game - Display to (All players) for 9.00 seconds the text: ((Name of (Owner of (Triggering unit))) + has advanced to the Classical Age!)
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Town Center) and do (Unit - Replace (Picked unit) with a Keep using The old unit's relative life and mana)

But then i realized that while this way replaces Town Centers I made before upgrading to the next tier, those that i built afterwards were still Town Centers and not at the same tier as the others. I also tried making it so the builder unit (Ulfsark) could build all the tiers of the Town Center which are as follows: Town Center, Keep, Stronghold, Fortress. But I ran to even more problems. I triggers, like the previous one, except these ones disabled the construction of prior tiers after upgrading a Town Center. For example, If I upgraded a Town Center to a Keep, then the trigger would disable Town Centers from being constructed by the builder. The problem was that once I met the requirements to upgrade to a particular tier, say a keep, those same requirements would allow me to build a keep with the builder before I had even upgraded to a Keep at a Town Hall as I made it so he could build all the tiers. It has been very complicated and I even tried a method where I made a mock town center to upgrade to. For example: a Town Center would upgrade to a "mock" Keep which I would then trigger to be replaced by an actual keep after the upgrade. I did this so I could initially disable the construction of all the tiers except the first one (Town Center) which would make it so I couldn't build them until i had enabled them with a trigger after upgrading to a tier. For example: In the build menu you can only build a Town Center as you haven't upgraded to the next tier. Then, you meet the requirements and upgrade tot he next tier. This causes a trigger to disable the construction of Town Centers, replace the mock unit that just finished upgrading with an actual Keep, and enable the construction of Keeps. I've tried every possible way i know how. There is no action for adding or removing a building from the build menu. It would be a lot easier if there was... i think ha.
 
Level 9
Joined
Dec 12, 2007
Messages
489
an idea to workaround your problems:
- make your builder to only be able to build the lowest tier of TC.

- make an array of unit-type to store the TC-type per tier level, example (using your term described above):
TC[1] = Town Center
TC[2] = Keep
TC[3] = Stronghold
TC[4] = Fortress

- make an integer global variable with value for your current tier level, for example if yours at lowest tier, set the value to 1 (according the array above). for ease of understanding, this variable will be called 'TierLevel' here.

- add 'set TierLevel = xx' to your Norse Keeps trigger above to match the new tier level and keep the replace event for existing TC.

- add a new trigger using 'A unit finishes construction' event and condition 'Unit-type of Constructed structure is <your lowest tier TC>', then check if the TierLevel is not equal to 1, replace constructed structure with TC[TierLevel].

at least those will allow you to keep using the lowest tier TC for building placement, and update the newly placed TC to match your current tier level.
 
Status
Not open for further replies.
Top