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

increasing the level of a unit ability using upgrades

Status
Not open for further replies.
Level 12
Joined
Jun 20, 2017
Messages
959
Ive tried making a 3 level upgrade to increase the level of a demolish ability, for some reason researching the upgrade does not increase the level of the ability

i've tried this with with several different upgrades, yet it doesn't work, is the editor hardwired not to do this?
 
Level 10
Joined
Apr 4, 2010
Messages
286
Good news is it's easily fixable with a trigger.

(Event)
A unit finishes researching an upgrade
(Conditions)
Upgrade = (your upgrade)
(Actions)
Pick all units of (relevant type) owned by (owner of researching unit) and do Actions
Set level of (your ability) for Picked unit to level of (your upgrade) for (owner of researching unit)

If this is an event that's going to happen a lot during a game, you can use a variable for the unit group and clean it up at the end of the trigger to prevent leaks using DestroyGroup(). But for a 3-tier upgrade that will only run this trigger 3 times it's probably not necessary.
See: Basic Memory Leaks
 
Last edited:
Level 10
Joined
Apr 4, 2010
Messages
286
Good call. You'll need a second trigger for those units.

(Events)
A unit finishes training a unit
(Conditions)
Unit-type of trained unit = (relevant unit type)
(Actions)
Set level of (ability) for trained unit to level of (upgrade) for owner of trained unit


If you use mercenary-style buildings that can hire units (instead of train them) you can duplicate this trigger for "sells a unit/unit being sold" as well.
 
Status
Not open for further replies.
Top