Warcraft III World Editor Tutorial – 12: Leaderboards and Timers

Leaderboards, Timers, and the Zergling Round-Up Map converted to Warcraft III – Now with Sheep!

Right then – Brace yourself as this is quite a long one.

If no-one ever played ‘Zergling Round-Up’ in Starcraft, the point of the game was to get Zerglings to certain areas, where they would be ‘captured’. At the end of the game, the player with the most Zerglings won.

This is a re-creation of that map. As I said, it is quite long and also quite complicated.

First create a map to be just how you want it. Then create eight regions. Four ‘Zoos’ (where the sheep will go), and four ‘Pens’ (where the sheep have to be rounded to. The zoos can be just 1 square big, but the pens have to be bigger – or the player could miss them.

Make sure they are all clearly marked, and that the pens are named ‘Pen 1’ (for player1), ‘Pen 2’ (for player2), ‘Pen 3’ (for player3), ‘Pen 4’ (for player4), ‘Zoo 1’ (for player1), ‘Zoo 2’ (for player2), ‘Zoo 3’ (for player3), and ‘Zoo 4’ (for player4).

Create the Variables

The variables needed for this to work are as follows:

Name – Type – Initial Value
P1Sheep – Integer – 0
P2Sheep – Integer – 0
P3Sheep – Integer – 0
P4Sheep – Integer – 0
SheepGot – LeaderBoard – – None –
Timer1 – Timer – – None –

Start-Up Trigger

Create a Trigger called ‘Map Initialization’.

Create the following in this trigger:

Events:
Map Initialization
Conditions:

Actions:
Wait 1.00 seconds
– Splits up the actions for better stability
Trigger – Run Leaderboard [gen] (ignoring conditions)

Creating the Leaderboard

Create a Trigger called ‘Leaderboard’.

Create the following in this trigger:

Events:

Conditions:

Actions:

Leaderboard – Create a Leaderboard for (All Players) titled Sheep
– Shows the leaderboard

Set SheepGot = (Last created leaderboard)
– This is our leaderboard

Leaderboard – Add Player 1 (Red) to SheepGot with label Player 1 and value P1Sheep
– Adds player 1 to the leaderboard

Leaderboard – Add Player 2 (Blue) to SheepGot with label Player 2 and value P2Sheep
– Adds player 2 to the leaderboard

Leaderboard – Add Player 3 (Teal) to SheepGot with label Player 3 and value P3Sheep
– Adds player 3 to the leaderboard

Leaderboard – Add Player 4 (Purple) to SheepGot with label Player 4 and value P4Sheep
– Adds player 4 to the leaderboard

Wait 1.00 seconds
– Splits up the actions for better stability

Countdown timer – Start Timer1 as a One-shot timer that will expire in 60.00 seconds
– Starts the timer for 60 seconds.

Countdown Timer – Create a timer window for Timer1 with the title Time Left:
– Makes a window that shows the remaining time.

Now we have to make a trigger that tells the leaderboard to improve a player’s score when he/she ‘Rounds-Up’ a sheep:

Create a Trigger called ‘Player 1 Got’.

Create the following in this trigger:

Events:
Unit – A unit enters Pen 1 [gen]
– If a unit enters the pen area for player 1
Conditions:
((Triggering unit) is in (Units of type Sheep)) Equal to True
– As long as the unit is a sheep
Actions:

Set P1Sheep = (P1Sheep + 1)
– Changes the score to the previous score + 1 for player 1

Leaderboard – Change the value for Player 1 (Red) in SheepGot to P1Sheep
– Shows the new score for player 1

Unit – Kill (Triggering unit)
– Kills the sheep

Unit – Create 1 Sheep for Player 1 (Red) at (Center of Zoo 1 [gen]) facing Default building facing degrees
– Makes a sheep at the Zoo location for player 1

Unit – Create 1 Sheep for Player 5 (Yellow) at (Center of Create [gen]) facing Default building facing degrees
– Makes a sheep at the Center of the play area to replenish the supplies.

Copy the above trigger, and paste it three times like with the last one, remember to change all of the variables, names, and re-mane the triggers too to ‘Player 3 Got’ etc. instead of ‘Player 1 Got Copy 2’.

Now you should have the following triggers:

  • Map Initialization
  • Leaderboard
  • Player 1 Got
  • Player 2 Got
  • Player 3 Got
  • Player 4 Got

All we need now is a trigger saying whether we win or loose!

Victory / Defeat Conditions.

Create a Trigger called ‘Game End’.

Create the following in this trigger:

Events:
– Time – Timer1 Expires
Conditions:

Actions:
Leaderboard – Sort SheepGot by Value in Descending order
– Sorts the players into rank order in the leaderboard

If ((Position of Player 1 (Red) in (SheepGot) Equal to 1) then do (Game – Victory Player 1 (Red) (Show dialogs, Show scores)) else do (Game – Defeat Player 1 (Red) with the message: Defeat!)
– This is another If/Then/Else trigger, it basically says if player one comes first place, then go to victory, if not, go to defeat.

Copy the above action and paste it three times, for each of the other players. Eg. for player 3, it would look like this:

If ((Position of Player 3 (Teal) in (SheepGot) Equal to 1) then do (Game – Victory Player 3 (Teal) (Show dialogs, Show scores)) else do (Game – Defeat Player 3 (Teal) with the message: Defeat!)

So in the end there should be four actions – one for each player.

There you go – that’s pretty much it. I’ll leave the layout of the map to you! I wouldn’t want to spoil all of your fun.

The final list of triggers should be:

  • Map Initialization
  • Leaderboard
  • Player 1 Got
  • Player 2 Got
  • Player 3 Got
  • Player 4 Got
  • Game End

NOTES

Once you have finished, you might want to re-arrange the order of the triggers and actions for better efficiency. You might want to add your own in-game cinematic before the game starts.

In any case, these triggers are only for the leaderboard and timer, nothing else. If you want anything unique, you will have to do it yourself.

ALSO!! – you might want to change the health of the sheep by editing them in the ‘Unit Editor’. I had problems testing my map, due to the swordsmen killing the sheep on the first blow!

The free-roaming ability of the sheep adds a great effect to the game, as the sheep all walk about, and i found they occassionally walked into the pen areas. Plus – when you attack one sheep, all the others run away!

Leave a Reply

Your email address will not be published. Required fields are marked *