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

How do I make weapon/armor upgrades instant?

Level 3
Joined
May 27, 2023
Messages
10
I need this done in a trigger format. I have a special building in the map that provides instant upgrade for players who find it. It would have the exact upgrade options as the player but it can be done instantly. This is to give motivation for players to find it.

How can I achieve this? I can't find any action that specifically targets armor/weapon upgrade progression.
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
Make the shop sell units. When such a unit is bought, remove the unit from the map and manually increase the level of the relevant tech for the player who purchased it.

It will be easiest if you set up two parallel arrays to link the unit-type to the tech (or use a hashtable if you are familiar with that, which would be better). SoldUnit[1] = ArmorUnit, SoldTech[1] = Fortified Armor and so on for all unit types sold by the shop. When the shop sells a unit, loop over all the unit types until you find a match with the sold unit, and then use the same index that matched to refer to the tech.

You will need to build logic to prevent buying a tech the player has already maxed, or just refund the purchase cost in that case.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
I think it'd make the most sense to detect when the Research begins, detect the Unit-Type of the Researcher, and if it matches your special building you simply Increase the level of the given Research. That may automatically cancel it, but if not, issue a "cancel" order to the building.

How you manage sharing ownership of the building could be done in many ways but you didn't mention the need for this.
 
Top