• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

[General] How Berserker Upgrade work ?

Status
Not open for further replies.
Level 6
Joined
Jul 14, 2020
Messages
128
Hi hive.
I've checked the forum and I think I can't find as a main topic, how Berserker Upgrade works.

I wanted to know what is equivalent to its operation, if it is exactly the same as using a Morph ability (Metamorphosis, ChemicalRage, Robo-Goblin, etc) or if it is equivalent to the function of "replace unit" that is available in triggers.

Or if not that all these types of transformation are the same.

I say this because sometimes strange things happen with this type of skills or functions, but I've been testing and I think it seems that Berserker Upgrade is the best option to use when someone want to transform to other unit.


Thanks :grin:
 
Level 27
Joined
May 18, 2018
Messages
397
The Berserker and Barrage upgrades have the same function. They are intended to replace one type of unit with a different one. What not many people know is that those upgrades don't work on their own.

The upgraded version of the units are disabled at the start of every game by this function:
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
This leaves each player with only the basic versions of those units (Headhunters and Siege Engines without Barrage) available to train, while the upgraded units will be unlocked once the players research the respective upgrade.

However, the upgrade only applies to units that are not yet trained. To apply the change to already trained or existing units on the map, they have an ability that is unlocked once the upgrade is researched, and that will replace them with the new unit.

There are several ways to mimic how these upgrades work. Check out this tutorial for a basic but easy way to implement a custom Berserk upgrade.
 
Level 6
Joined
Jul 14, 2020
Messages
128
The Berserker and Barrage upgrades have the same function. They are intended to replace one type of unit with a different one. What not many people know is that those upgrades don't work on their own.

The upgraded version of the units are disabled at the start of every game by this function:
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
This leaves each player with only the basic versions of those units (Headhunters and Siege Engines without Barrage) available to train, while the upgraded units will be unlocked once the players research the respective upgrade.

However, the upgrade only applies to units that are not yet trained. To apply the change to already trained or existing units on the map, they have an ability that is unlocked once the upgrade is researched, and that will replace them with the new unit.

There are several ways to mimic how these upgrades work. Check out this tutorial for a basic but easy way to implement a custom Berserk upgrade.
Thanks for the information, it was very useful :thumbs_up:
 
Status
Not open for further replies.
Top