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

Unit upgrade

Status
Not open for further replies.
Level 5
Joined
Jul 5, 2014
Messages
155
I want to make a unit upgrade just like the troll headhunter-berserker works, but my upgraded unit appears next to the unupgraded. How can I make it unavailable until an upgrade replaces it?
 
Level 14
Joined
Jun 15, 2016
Messages
749
I want to make a unit upgrade just like the troll headhunter-berserker works, but my upgraded unit appears next to the unupgraded. How can I make it unavailable until an upgrade replaces it?
You need:
- A structure to train both versions of that unit.
- An upgrade based on Berserker Upgrade, give it to the structure as "upgrade used" and "upgrade research".
- An ability based on Upgrade Berserker, give it to the original unit only as ability.
- In trigger editor, add event map initialization, make the secondary unit unavailable for all players. => This is what you need.
 
Level 5
Joined
Jul 5, 2014
Messages
155
Hmm, thanks it worked after adding the trigger. But isn't there a way around it? Troll berserkers are unavailable by default on melee maps, isn't is possible to make the upgraded unit similarly unavailable without trigger?
 
Level 12
Joined
Nov 3, 2013
Messages
989
After you've created the custom unit you want to be replaced, like a custom Troll Berserker, save the map. (Which you won't need to do since you've already done this.)

Then click on the "scenario" dropdown & then the "techtree properties" button at the top of the world editor, there you will find your newly added units.

Click on "use custom techtree", then find where your berserker-like unit is (the one that will be unavailable before researching the upgrade), and uncheck the "available" checkbox.

It will be listed under "special" instead of "units" if you've set that field to true in the object editor.


And then it will work... It does exactly the same as just making the unit unavailable with trigger at map init. (And actually, I noticed that apparently Troll Berserker is still available by default here, so I guess even for melee it's part of map init trigger or something? lol)
 
And then it will work... It does exactly the same as just making the unit unavailable with trigger at map init. (And actually, I noticed that apparently Troll Berserker is still available by default here, so I guess even for melee it's part of map init trigger or something? lol)
Was also interested after reading your post:
I found a function in blizzard.j which deactivades berserk and dat tank, also it runs for any map its a sub function of InitBlizzard. it is inside InitSummonableCaps. So yes blizzard did it like you people suggest to do.

From Blizzard.j
JASS:
function InitSummonableCaps takes nothing returns nothing
    local integer index

    set index = 0
    loop
        // upgraded units
        // Note: Only do this if the corresponding upgrade is not yet researched
        // Barrage - Siege Engines
        if (not GetPlayerTechResearched(Player(index), 'Rhrt', true)) then
            call SetPlayerTechMaxAllowed(Player(index), 'hrtt', 0)
        endif

        // Berserker Upgrade - Troll Berserkers
        if (not GetPlayerTechResearched(Player(index), 'Robk', true)) then
            call SetPlayerTechMaxAllowed(Player(index), 'otbk', 0)
        endif

        // max skeletons per player
        call SetPlayerTechMaxAllowed(Player(index), 'uske', bj_MAX_SKELETONS)

        set index = index + 1
        exitwhen index == bj_MAX_PLAYERS
    endloop
endfunction
 
Status
Not open for further replies.
Top