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

Multiple Individual unit upgrades

Status
Not open for further replies.
Level 9
Joined
Jun 10, 2013
Messages
473
I was wondering what would be the easiest way to achieve the following:

UnitTypeA can recieve all of the following upgrade:

1UPG
2UPG
3UPG
4UPG
5UPG
6UPG
7UPG

Each upgrades costs 100 wood, 100 gold and may be purchased from the unit itself, upon purchase the upgrade is replaced by its corresponding ability. However the upgrades effect the individual unit alone and not all other units of that type

Example:

FootmanA and FootmanB have to upgrades available for purchase in their "Command Set"

Upgrades:
Shield Defend (Upon purchase upgrades button position is replaced with the corresponding ability)
Fire Sword (Upon purchase upgrades button position is replaced with the corresponding ability)

The player then chooses to purchase "Shield Defend" for FootmanA and "Fire Sword" for FootmanB. Now FootmanA can still be equipped with the "Fire Sword" upgrade and FootmanB can still be equipped with the "Shield Defend" upgrade, since the upgrades only effect the individual unit and not the Unit Type.




Now I've thought of several ways of going about this; however, I'd like to see what the other Hive-Minds think and how they'd go about doing it.
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
Upgrades itself are not possible, because each upgrade can only be researched once.

7 upgrades are a lot. You might have to put them inside a spellbook, because the command card could not have enough space. Together with the 5 standard buttons (move, patrol, attack, stop, hold position) the command card is already full.
Anyway you should use an ability instead of an upgrade. There is an ability called "Charge gold and lumber". It costs resources to be cast. You can also change its order id like you can with channel. So you can use multiple versions of this abiltiy on one unit.
When this ability is used, you remove it and add the actual ability.

For best efficiency and readability I would use a hashtable to map upgrade abilities to the actual abilities.
 
1) Add shop abilities to the unit, and select unit ability that doesn't show a model but can only target "self"
2) Add inventory to the unit if needed
3) Make a powerup item that the unit can buy from itself that causes it to gain an ability, you can easily create a system for it, then just remove the unit's ability to sell that item again

This is really easy to make in Wurst, since object editing natives would allow you to easily create the item and ability side by side, as well as store their ids to associate them.
 
Status
Not open for further replies.
Top