1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Actually limiting the custom heros to 1 per

Discussion in 'World Editor Help Zone' started by Eagle XI, Nov 19, 2015.

  1. Eagle XI

    Eagle XI

    Joined:
    Mar 9, 2012
    Messages:
    1,359
    Resources:
    117
    Models:
    2
    Icons:
    109
    Packs:
    4
    Skins:
    2
    Resources:
    117
  2. Razosh

    Razosh

    Joined:
    Jul 9, 2009
    Messages:
    3,860
    Resources:
    0
    Resources:
    0
    • Melee Initialization
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
     
  3. Eagle XI

    Eagle XI

    Joined:
    Mar 9, 2012
    Messages:
    1,359
    Resources:
    117
    Models:
    2
    Icons:
    109
    Packs:
    4
    Skins:
    2
    Resources:
    117
    If you had actually bother to look would see that it exists.
     
  4. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Create a trigger that runs on map initialization.
    Then you pick all players in... all players and you limit training of <MyHero> for the picked player to 1.

    This is exactly how that melee game action works... except that it only loops through all standard heroes (4 human, 4 orcs, 4 night elves, 4 undead and 9? neutral)
    Custom heroes ofcourse has to be added manually.
     
  5. Eagle XI

    Eagle XI

    Joined:
    Mar 9, 2012
    Messages:
    1,359
    Resources:
    117
    Models:
    2
    Icons:
    109
    Packs:
    4
    Skins:
    2
    Resources:
    117
    Ok, well, using that classic method didnt clash with the script.
    I thought it would, hence the asking, so this solved itself.
     
  6. Legal_Ease

    Legal_Ease

    Joined:
    Feb 8, 2013
    Messages:
    1,453
    Resources:
    28
    Icons:
    11
    Packs:
    1
    Skins:
    2
    Maps:
    10
    Template:
    1
    Tutorials:
    3
    Resources:
    28
    • Hero Initialize
      • Events
        • Unit - A unit Sells a unit
      • Conditions
        • ((Sold unit) is A Hero) Equal to True
      • Actions
        • Player - Limit training of (Unit-type of (Sold unit)) to 1 for (Owner of (Sold unit))
        • Custom script: set bj_wantDestroyGroup = true
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in (Units owned by (Owner of (Sold unit)) matching (((Matching unit) is A Hero) Equal to True))) Equal to 1
          • Then - Actions
            • Hero - Create Scroll of Town Portal and give it to (Sold unit)
          • Else - Actions
     
  7. Xonok

    Xonok

    Joined:
    Mar 27, 2012
    Messages:
    3,045
    Resources:
    8
    Spells:
    3
    Tutorials:
    5
    Resources:
    8
    Why don't you just add the custom heroes to gameplay constants? After all, this is how the usual heroes get handled.
     
  8. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,190
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Does not handle all of it. Specifically the limit heroes type to 1 per player. You need to use triggers for that.

    The action that limits training of a unit type to 1 works for this purpose.