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

[General] Hero Limit Concept

Status
Not open for further replies.
Level 5
Joined
May 8, 2020
Messages
78
Limit Hero
Events
Map initialization
Conditions
Actions
Melee Game - Limit Heroes to 1 per Hero-type (for all players)

Is there any way to help me limit Hero to 2 Every player
is (Entering Unit) NOT (Trainer Unit) ?
 
Last edited:
Level 5
Joined
May 8, 2020
Messages
78
They will control up to 2 heroes different
but the main point is to just let them use 2 heroes
 
Last edited:
Level 25
Joined
Sep 26, 2009
Messages
2,382
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • Player - Limit training of Heroes to 2 for (Picked player)
If you are also using
  • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
then make sure the Player action is placed AFTER the Melee Game action like so:
  • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • Player - Limit training of Heroes to 2 for (Picked player)
 
Level 5
Joined
May 8, 2020
Messages
78
Creat Hero
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
Unit - Create 1 Archmage for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees

so what about the command to create units? i tried it unlimited hero , i tried many it doesn't work , it only limits heroes from trainer
 
Last edited:
Level 25
Joined
Sep 26, 2009
Messages
2,382
Creating unit via triggers ignores such things. You will have to keep track of created heroes yourself.
  • Create Hero
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • count Less than 2
    • Actions
      • Set VariableSet count = (count + 1)
      • Unit - Create 1 Archmage for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
 
Level 5
Joined
May 8, 2020
Messages
78
Limit Hero To 2 all player
Events
Unit - A unit enters (Playable map area)
Conditions
Actions
Set Player = (Player number of (Owner of (Entering unit)))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Player Greater than 2
Then - Actions
Unit - Remove (Entering unit) from the game
Else - Actions

I have a bit complicated command line, it's random hero

it will appear in the middle of the map , but when i enter the -random command repeatedly it will show up to 8 heroes .

Is there a way for me to limit the hero appearing on the map to 2 per person without having to turn it off? basically because the whole map content is jass in it
I searched a lot, but the result is only limit hero tranning
 
Last edited:
Level 25
Joined
Sep 26, 2009
Messages
2,382
Check the tutorial on how to post triggers on this site, it's getting harder and harder to understand just from the text dump

As for limiting number of heroes per player to 2, you can use the power of friendship arrays where the index matches player's number. This is how the previous trigger that ran every 2 seconds would look like if it were creating heroes for all players:
  • Create Hero Multiple Players
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HeroCount[(Player number of (Picked player))] Less than 2
            • Then - Actions
              • Set VariableSet HeroCount[(Player number of (Picked player))] = (HeroCount[(Player number of (Picked player))] + 1)
              • Unit - Create 1 Archmage for (Picked player) at (Center of (Playable map area)) facing Default building facing degrees
            • Else - Actions
The HeroCount is an integer variable with the 'Array' checkbox checked.
 
Status
Not open for further replies.
Top