• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Need 1 Hero Only Per HQ Upgrade

Status
Not open for further replies.
Level 7
Joined
Feb 20, 2016
Messages
274
I added custom heroes to the altars but I can build an original hero + custom hero at beginning of the game. I need to tell the game to not allow the custom hero to be built if I already have one.

Cheers
 
Level 7
Joined
Aug 5, 2010
Messages
147
You could use this

  • Example 1
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Player - Limit training of Heroes to 1 for Player 1 (Red)
or this

  • Example 2
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in (All Players) and do (Actions)
        • Loop - Actions
          • Player - Limit training of Heroes to 1 for (Picked player)
Those 2 triggers assume you only want the player to have only 1 hero, you could also remove this limit later in the game by creating a similar trigger but setting Time - Elapsed game time to a certain time you want and Player - Limit training of Heroes either to the limit of heroes you want or -1 that will allow unlimited heroes.

If you want the player to be able to get multiple heros but only 1 hero, be it custom or default then give your custom hero the same techtree requirements in tech 1 and tech 2.

I have attached an example map with both triggers and a custom hero that has the same techtree requirements as the default archmage, if a player trains a default hero they will not be able to train another hero until they upgrade the town hall thus limiting the heros the player can get at the start of the game.
 

Attachments

  • HeroLimit.w3x
    16.6 KB · Views: 37
Last edited:
Level 7
Joined
Feb 20, 2016
Messages
274
You could use this

  • Example 1
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Player - Limit training of Heroes to 1 for Player 1 (Red)
or this

  • Example 2
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set PlayerGroup = (All players)
      • Player Group - Pick every player in PlayerGroup and do (Actions)
        • Loop - Actions
          • Player - Limit training of Heroes to 1 for (Picked player)
      • Custom script: call DestroyForce(udg_PlayerGroup)
Those 2 triggers assume you only want the player to have only 1 hero, you could also remove this limit later in the game by creating a similar trigger but setting Time - Elapsed game time to a certain time you want and Player - Limit training of Heroes either to the limit of heroes you want or -1 that will allow unlimited heroes.

If you want the player to be able to get multiple heros but only 1 hero, be it custom or default then give your custom hero the same techtree requirements in tech 1 and tech 2.

I have attached an example map with both triggers and a custom hero that has the same techtree requirements as the default archmage, if a player trains a default hero they will not be able to train another hero until they upgrade the town hall thus limiting the heros the player can get at the start of the game.


Adding the techtrees didn't fix it.
 
Status
Not open for further replies.
Top