1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

(SOLVED) - Hero limit problem

Discussion in 'Requests' started by Diegoit, Sep 17, 2018.

  1. Diegoit

    Diegoit

    Joined:
    Apr 8, 2017
    Messages:
    1,215
    Resources:
    1
    Models:
    1
    Resources:
    1
    How to make 1 hero type limit, i can make like unlimited type of hero but i only want 1

    Useless -> help with 1 hero limit

    [​IMG]

    PLEASE HELP
     

    Attached Files:

  2. Wildfire

    Wildfire

    Joined:
    Sep 6, 2017
    Messages:
    160
    Resources:
    21
    Icons:
    16
    Skins:
    5
    Resources:
    21
    Maybe this will help
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)
     
  3. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,187
    Resources:
    1
    Spells:
    1
    Resources:
    1
    @Diegoit you need to be more specific. One per player or one per map? The trigger posted by Wildfire does 1 per map, but if you want one per player you will need to add your heroes to the Techtree - Dependency Eqivalents - Hero field in Gameplay Constants (make sure "use custom gameplay constants" is checked too). I don't think you'll also have to add your altars to the altar equivalency line, but it's possible you do.
     
  4. Diegoit

    Diegoit

    Joined:
    Apr 8, 2017
    Messages:
    1,215
    Resources:
    1
    Models:
    1
    Resources:
    1
    I mean one per player, like standard melee maps, that picture shows that after training that hero and im still available to train it again.

    Ill check what u said.
     
  5. Diegoit

    Diegoit

    Joined:
    Apr 8, 2017
    Messages:
    1,215
    Resources:
    1
    Models:
    1
    Resources:
    1
    Nope, it doesnt work :(
     
  6. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,187
    Resources:
    1
    Spells:
    1
    Resources:
    1
    So it turns out that in nearly every thread where someone has this same question, a user invariably suggests Gameplay Constants + the melee limit heroes action. In this thread that person is, unfortunately, me. It seems logical, right? And why would the game make you do something else if the GPC field exists, right? Nope. Turns out this post by @BloodSoul finally made it clear what's going on (tbf I should have checked Blizzard.j myself but I didn't), which is the melee limit action internally does a Player - Limit training of <hero type> for <player> to <the GPC max number of each hero> loop for all the different base Melee heroes. Custom ones, obviously, it doesn't do that for. But it would REALLY make sense for it to have been a function that dynamically pulls all the rawcodes of heroes from the GPC list and adds them to that function. C'mon, Blizzard!

    The BJ function
    Code (vJASS):
    function MeleeStartingHeroLimit takes nothing returns nothing
        local integer index

        set index = 0
        loop
            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


    So ultimately you do also have to limit the heroes yourself with the trigger below. The custom heroes and your custom altars should still be added to the relevant GPC techtree equivalent list, though.

    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All Players) and do (Actions)
        • Loop - Actions
          • Player - Limit training of <your hero> to 1 for (picked player)
     
  7. Diegoit

    Diegoit

    Joined:
    Apr 8, 2017
    Messages:
    1,215
    Resources:
    1
    Models:
    1
    Resources:
    1
    Done!, it works :D, thanks bro, very helpful ;).