Hero Arenas and Choosing heroes

By SD_Ryoko


This tutorial is about creating an area for a player to choose his hero. This is most common in hero arena maps, where players are given a wisp, or 'chooser unit' and can select which hero they want to play. This tutorial will cover how to create an area for choosing heroes, and how to set up the triggers that create them.

See also: Hero Taverns

Basic Hero Setup

The setup we are going to use today is seen in many hero arena maps. There will be a group of heroes in a remote location on the map, with a circle of power next to each hero. Each player is given a wisp, and a hero is created when they step inside the circle.

We will need to designate an area on the map for your heroes. For every available choice, we will need one hero, one circle of power and one region. The hero on the map is only to show the player which hero they can choose, and nothing more. The hero should belong to neutral passive, so they don't wander or attack anyone. If you need to, you can make the heroes invunerable at map initalization, to prevent players from attacking them.

The circle of power in front of it is where the wisp should go to choose that hero. We will also need a region inside the circle of power. For now, we will start with two heroes in this example.

  • Place a hero on the map for every hero your map has.
  • Create a circle of power somewhere near the hero.
  • Create a region that fits inside the circle of power.
  • Heroes should belong to neutral passive.

Hero Choose
Create an area for choosing heroes.

Creating Wisps

Every player in the game will need a wisp (or other chooser type unit) to select which thero they want to play. When the game starts, we would like each player to be looking at the available heroes, so we will create the player starting locations somewhere in that area. Do not place the starting units to close to eachother, or sometimes the wisp cannot be created there.

Next we will need to create the wisps. It is easy to place a wisp for each player near the heroes, but if a player is not present, there will be an inactive wisp sitting on the map. I prefere to create a wisp only for players in the game, so we are going to create the wisps for each player using a trigger. Also, my trigger will only make a wisp for human controlled players that are in the game, and not spectating or defeated.

  • Create a starting location for each player near your heroes.
  • Add a trigger that creates a wisp for each player.
Create Wisp
        Map initialization
        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
                        ((Picked player) controller) Equal to User
                        ((Picked player) slot status) Equal to Is playing
                    Then - Actions
                        Unit - Create 1 Wisp for (Picked player) at ((Picked player) start location) facing Default building facing degrees
                    Else - Actions
                        Do nothing

Rules about Choosing Heroes

Every map has different rules about choosing a hero. Some maps allow a player to pick any hero they like. Other maps only allow one of each hero to be picked. Typically, modern maps only allow one of each hero, and have options such as -repick and -random. In this example, we will limit heroes to one of each type and add a repick system. You can later add more options later if you like.

First to keep track of what heroes have been taken, we will need to store that in a variable. We are going to make and integer type variable, that is an array. By default, all the integers will be zero. Each integer represents one of the heroes on your map. Inside the trigger module, click on Edit, Variables and create a variable as shown.

  • An integer variable stores which heroes have been taken.
  • Create an integer array inside the Variable Editor.
  • Maps can also have options like -repick and -random.

Hero Choose
Adding a variable to control heroes.

Creating Heroes with Triggers

The last thing we need to do is add a trigger to create the heroes. If you are more advanced in trigger code, you can store your hero types and regions inside an array. This example will keep it rather simple. We will have one trigger for every available hero. It is a little more work, but once you finish the first trigger, you can copy it and alter it for the next hero.

When the wisp steps inside a circle, we will first check to see if that hero is taken. If not, we will create the hero, mark that hero as taken, and remove the wisp from the game. For visual purposes, we will hide that hero on the map so that players know it is unavailable.

My trigger will create the hero in the center of the map. If you want to create them somewhere else, you could make a new region somewhere in your map. Typically, players and teams have different starting places, and you will either one or two regions to place the heroes. Lastly, if you wanted to add a -repick system later, all you would have to do is unhide that type of hero on the map, and set our variable back to zero for that hero.

  • Create a trigger for every hero available in your map.
  • Hide the hero on the map.
  • Create a hero for the owner of the wisp.
  • Remove the wisp or chooser unit from the game.

My variable corresponds with my regions. Hero one is region one, and hero two is region two.

Choose Hero 1
        Unit - A unit enters Hero 1 Region <gen>
        ((Unit-type of (Triggering unit)) Equal to Wisp) and (Pick_Taken[1] Equal to 0)
        Set Pick_Taken[1] = 1
        Unit - Hide Demon Hunter 0001
        Unit - Create 1 Demon Hunter for (Owner of (Triggering unit)) at (Center of Start Region <gen>) facing Default building facing degrees
        Camera - Pan camera for (Owner of (Triggering unit)) to (Center of Start Region <gen>) over 0.00 seconds
        Unit - Remove (Triggering unit) from the game

Choose Hero 2
        Unit - A unit enters Hero 2 Region <gen>
        ((Unit-type of (Triggering unit)) Equal to Wisp) and (Pick_Taken[2] Equal to 0)
        Set Pick_Taken[2] = 1
        Unit - Hide Sorceress 0002
        Unit - Create 1 Sorceress for (Owner of (Triggering unit)) at (Center of Start Region <gen>) facing Default building facing degrees
        Camera - Pan camera for (Owner of (Triggering unit)) to (Center of Start Region <gen>) over 0.00 seconds
        Unit - Remove (Triggering unit) from the game

Repick Trigger

Now I want to add a repick trigger to the map. It will work similar to the other hero triggers, but it will work backwards. When any player types -repick, I want to unhide the dummy unit, and make my Pick_Taken variable for that hero 0, so it is available again. I've noticed if you don't make the hero available again, you start running out of heroes. We will use IF statements to determine what hero that player has. After unhiding the dummy unit, we will remove his hero from the game and creating a new wisp for the player to use.

  • Pick a hero unit owned by that player.
  • Unhide that type of unit.
  • Change our variable for that type of unit.
  • Remove the hero from the game.
  • Create a new wisp for that player.

If you want, you can make the hero available again, by unhiding the unit and setting Pick_Taken[] to 0.

Repick Hero
        Player - Player 1 (Red) types a chat message containing -repick as An exact match
        Player - Player 2 (Blue) types a chat message containing -repick as An exact match
        Player - Player 3 (Teal) types a chat message containing -repick as An exact match
        Unit Group - Pick every unit in (Random 1 units from (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))) and do (Actions)
            Loop - Actions
                Unit - Remove (Picked unit) from the game
        Camera - Pan camera for (Triggering player) to ((Picked player) start location) over 0.00 seconds
        Unit - Create 1 Choose A Hero for (Triggering player) at (Center of WispRegions[(Player number of (Triggering player))]) facing (Center of Start Region <gen>)


After getting all the basics down, you can add more advanced options. A lot of how the map works is personal preference, but this should get you off to a good start. When you are done, you should have an area on your map that looks like this.

Hero Choose
Finished hero arena.

Blizzard Entertainment, Inc.
Silkroad Online Forums
Team Griffonrawl Trains Muay Thai and MMA fighters in Ohio.
Apex Steel Pipe - Buys and sells Steel Pipe.