How do I make weapon/armor upgrades instant?

Status
Not open for further replies.
Level 3
Joined
May 27, 2023
Messages
18
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 45
Joined
Feb 27, 2007
Messages
5,578
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 73
Joined
Aug 10, 2018
Messages
7,866
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.
 
Status
Not open for further replies.
Top