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

[General] Limit training of heroes question

Status
Not open for further replies.
Level 19
Joined
Jul 2, 2011
Messages
2,162
If I use the trigger limit training of heroes does that count also for if I create a hero on location with trigger?

Also, when I remove a hero from the game with a trigger does this affect the "limit training of heroes" trigger?
Why don't you test it out yourself?
There is no way of telling unless you have the experience, and your problem is very easily tested and proven for yourself

Edit

The above means this user doesn't know how to answer your question, and would rather criticise your question and character
 
Last edited:
Level 13
Joined
May 10, 2009
Messages
868
If I use the trigger limit training of heroes does that count also for if I create a hero on location with trigger?
Well, it certainly sets the techtree requirement for a player to the next tier, which means that in order to train a new hero, the player needs to upgrade their town hall. If you try to force-create a new hero via triggers, it'll be created no matter what the techtree requirement says.

Also, when I remove a hero from the game with a trigger does this affect the "limit training of heroes" trigger?
No. If you remove a hero, the number of trained heroes for the techtree will still be considered as the same. So, creating and removing one will force you to upgrade to the next tier in order to train another. I believe it's because the hero requirement is considered as an upgrade, so you can't set its current value back to a lower number.

  • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
->
JASS:
function MeleeStartingHeroLimit takes nothing returns nothing
    local integer index

    set index = 0
    loop
        // \/ I am talking about this little function here \/
        call SetPlayerMaxHeroesAllowed(bj_MELEE_HERO_LIMIT, Player(index))
        // /\                                              /\

        // each player is restricted to a limit per hero type as well
        call ReducePlayerTechMaxAllowed(Player(index), 'Hamg', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Hmkg', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Hpal', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Hblm', bj_MELEE_HERO_TYPE_LIMIT)

        call ReducePlayerTechMaxAllowed(Player(index), 'Obla', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Ofar', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Otch', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Oshd', bj_MELEE_HERO_TYPE_LIMIT)

        call ReducePlayerTechMaxAllowed(Player(index), 'Edem', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Ekee', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Emoo', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Ewar', bj_MELEE_HERO_TYPE_LIMIT)

        call ReducePlayerTechMaxAllowed(Player(index), 'Udea', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Udre', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Ulic', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Ucrl', bj_MELEE_HERO_TYPE_LIMIT)

        call ReducePlayerTechMaxAllowed(Player(index), 'Npbm', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Nbrn', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Nngs', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Nplh', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Nbst', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Nalc', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Ntin', bj_MELEE_HERO_TYPE_LIMIT)
        call ReducePlayerTechMaxAllowed(Player(index), 'Nfir', bj_MELEE_HERO_TYPE_LIMIT)

        set index = index + 1
        exitwhen index == bj_MAX_PLAYERS
    endloop
endfunction
->

call SetPlayerMaxHeroesAllowed(bj_MELEE_HERO_LIMIT, Player(index))

Which is the same as:

  • Player - Limit training of Heroes to 3 for Player(index)
->
JASS:
call SetPlayerTechMaxAllowed(Player(index), 'HERO', 3)

So, whenever you create/train a new hero, the game internally calls this (or a similar) function:
  • Player - Set the current research level of HERO to +1 for Player(index)
->

call SetPlayerTechResearched(whichPlayer, 'HERO', GetPlayerTechCount(whichPlayer, 'HERO', true) + 1)
 
Status
Not open for further replies.
Top