• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Disable builds and upgrade

Status
Not open for further replies.
Level 4
Joined
Jan 18, 2016
Messages
29
Currently working on a campaign and was wondering: how do you disable the worker from not being able to build certain buildings?
From example, in the original RoC campaign, peasants in the 2nd mission can only build 1st tier buildings like barracks, farms etc but unable to build Arcane sanctum.
Also the Town Hall is unable to upgrade to Keep in that mission. So how do I disable them in my map?
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Well, I can see three ways to do this:

1) Simply remove those buildings from the build/upgrade menu.
If those buildings aren't even going to be used in said map, there's no need to go out of your way to disable them, when you can simply remove them. That means you need to edit the object editor data.
For workers, find "Techtree - Structures Built" field and remove all unwanted structures.
For building upgrades, search and edit the "Techtree - Upgrades To" field.

The disadvantage of this method is that it is global - in other words, if you edit "Human" race this way, all players with Human race will be affected.

2) Edit Player's Techtree Properties.
In the menu in the top bar of your world editor go to "Scenario" -> "Techtree Properties...". In the newly opened window check the "Use Custom Techtree" checkbox. Then you simply select player and choose buildings/units/upgrades and by unchecking specific boxes you disable that thing in game.
It's basically an easier version of the method #1, with the advantage that you set this for each player alone (in comparison to methdod #1 where it was globally for that race)

3) Set building availability via triggers.
You can make buildings/units (un)available for construction/training by using the following action:
  • Player - Make Lumber Mill Available for training/construction by Player 1 (Red)
The actions is "Player - Set Training/Construction Availability Of Unit".

The advantage of this approach is that you can change the availability dynamically during game, while method #2 is set on map initialization only.


Example:
You want to have this situation: At the start of the map, you can only build Town Hall. Once you build Town Hall you want the player to be able to build any other building.

The way to do this is by disabling all buildings except for Town Hall (via method #2).
However you will need method #3 to catch when Town Hall has been built and via trigger actions in method #3 enable other buildings.
 
Level 1
Joined
Feb 5, 2022
Messages
3
Well, I can see three ways to do this:

1) Simply remove those buildings from the build/upgrade menu.
If those buildings aren't even going to be used in said map, there's no need to go out of your way to disable them, when you can simply remove them. That means you need to edit the object editor data.
For workers, find "Techtree - Structures Built" field and remove all unwanted structures.
For building upgrades, search and edit the "Techtree - Upgrades To" field.

The disadvantage of this method is that it is global - in other words, if you edit "Human" race this way, all players with Human race will be affected.

2) Edit Player's Techtree Properties.
In the menu in the top bar of your world editor go to "Scenario" -> "Techtree Properties...". In the newly opened window check the "Use Custom Techtree" checkbox. Then you simply select player and choose buildings/units/upgrades and by unchecking specific boxes you disable that thing in game.
It's basically an easier version of the method #1, with the advantage that you set this for each player alone (in comparison to methdod #1 where it was globally for that race)

3) Set building availability via triggers.
You can make buildings/units (un)available for construction/training by using the following action:
  • Player - Make Lumber Mill Available for training/construction by Player 1 (Red)
The actions is "Player - Set Training/Construction Availability Of Unit".

The advantage of this approach is that you can change the availability dynamically during game, while method #2 is set on map initialization only.


Example:
You want to have this situation: At the start of the map, you can only build Town Hall. Once you build Town Hall you want the player to be able to build any other building.

The way to do this is by disabling all buildings except for Town Hall (via method #2).
However you will need method #3 to catch when Town Hall has been built and via trigger actions in method #3 enable other buildings.
Hey... but uh, so when I for example for the 2nd method, remove something from the Techtree, how do I then save that globally, or is it literally only for some selected map?

There is only the 'Save Map' option for saving... I want to hecking save things globally, not for some map man! 😭
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Yes, it is only for the single map.
The closest thing I know of would be to use campaign editor - campaign data are shared by all maps in the campaign (though I am not sure how relevant this is with reforged), but you are limited somewhat - I don't think option #2 is available in any form in campaign editor.

Last option would be to mod WC3 itself, but I do not have experience with that personally, so I am unsure what drawbacks and limitations that has.
 
Level 1
Joined
Feb 5, 2022
Messages
3
Yes, it is only for the single map.
The closest thing I know of would be to use campaign editor - campaign data are shared by all maps in the campaign (though I am not sure how relevant this is with reforged), but you are limited somewhat - I don't think option #2 is available in any form in campaign editor.

Last option would be to mod WC3 itself, but I do not have experience with that personally, so I am unsure what drawbacks and limitations that has.
Couldn't Google much at all, in regards that of 'global editing', so thank for you clarifying necropost! Much in the spirit of le Barragan... somehow... maybe 🤔

But yeah, I think I'll just give up on this silly endeavor tbh. My 'plan' was originally to try and remove all flying units from the game/maps... ah, it's a blessing in disguise in terms of further time wasting, mhm 😞
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,511
Couldn't Google much at all, in regards that of 'global editing', so thank for you clarifying necropost! Much in the spirit of le Barragan... somehow... maybe 🤔

But yeah, I think I'll just give up on this silly endeavor tbh. My 'plan' was originally to try and remove all flying units from the game/maps... ah, it's a blessing in disguise in terms of further time wasting, mhm 😞
You could do this pretty easily by editing the Object Editor data in a melee map and then Exporting it so it can be Imported it into the rest of them. Or make a trigger that Limits the training of all of the Flying Units during Map Initialization and copy and paste that into each map (seems easier). It'd probably take you less than 30 minutes to edit/save all of the melee maps.
 
Level 1
Joined
Feb 5, 2022
Messages
3
You could do this pretty easily by editing the Object Editor data in a melee map and then Exporting it so it can be Imported it into the rest of them. Or make a trigger that Limits the training of all of the Flying Units during Map Initialization and copy and paste that into each map (seems easier). It'd probably take you less than 30 minutes to edit/save all of the melee maps.
Thank you for presenting the final solution. Mhm, perhaps I'll end up using AHK the Trigger propagation
 
Status
Not open for further replies.
Top