HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to make a Team Defence

09-16-2006, 03:54 PM#1
Andrewgosu
PART I
Give a meaning to your TD - Theoretical part


Introduction: The trigger part is mainly for a TD meant for TD with 1 or 2 teams. Some tweakage is required by you, if you wish to make a TD, where every players defends for himself/herself.

Frozen Throne Required


Planning Creeps
Planning Towers
Planning Pathing


Before we are going to make some real triggers, you have to know, what you are planning to create – creeps, towers, abilities and/or special features, twists. I am going to give a few tips how to do that.

Step 1 - Planning Creeps

Firstly, open Excel (I tend to create my notes, plans in excel or in word, but pencil and paper or text editing programs will do, too.) and create 6 columns named creep, level, HP, special features, movement speed and armor.

Zoom (requires log in)

Then leave one row blank and start filling the table. It makes your life a lot easier: You can put down notes, even if you are not able to use WE. (Maybe you are at work, on vacation with a laptop, ect)

Zoom (requires log in)

Step 2 – Planning Towers

For planning towers, open sheet 2. Now create 7 columns named tower, cost, damage, attack, cooldown, upgrades to and special features.

Zoom (requires log in)

Now remains only the issue of thinking out the towers, and filling the table. (I find thinking out things as amusing as creating them in WE for real).

Zoom (requires log in)

Step 3 – Planning Pathing

The keyword for team defences is symmetry. You want to give all the players equal oppurtunities, which makes gameplay fair. Before starting, decide, how many players your TD is going to have. My TD is going to have 8 players. Now, ill make a scetch drawing of my pathing map, considering it has to be symmetrical for 8 players.

Zoom (requires log in)

I used Excel, so no drawing skills required to do this simple scetch. (Row and Cell width are the same)

As you see, I have marked the starting positions and end point. Now, being happy with the result, ill make it for real, in WE.
Attached Images
File type: jpgExcel.jpg (7.5 KB)
File type: jpgExcel2.jpg (25.5 KB)
File type: jpgExcel3.jpg (9.5 KB)
File type: jpgExcel4.jpg (70.0 KB)
File type: jpgExcel5.jpg (61.8 KB)
09-16-2006, 03:55 PM#2
Andrewgosu
PART II
Making your plans true

Making Towers
Tower Upgrades
Building Towers
Modifying Creeps


Step 1 – Making Towers

Start making your towers, by opening Object editor and choosing a base tower. Ill choose Undead Spirit Tower, because if you use a undead builder and an undead tower, you can build multiple towers at a same time. Like, when building with undead builder in melee maps.

Start, by changing the base damage. I changed the base damage to 16 for my level 1 Spirit Tower. Now I bet you ask what dice and side do, how do I operate with them. Its actually very easy, if you follow the formula.

Zoom (requires log in)

After that, if you want, you can adjust the fire rate, cooldown. The lower it is, the faster it shoots.

Now, get rid of the building requirements of your towers, because you are making a TD, not a melee map. This allows your builder to build level 1 towers from the beginning of the game.

Zoom (requires log in)

Because I based my towers off an Undead building, remove the blight growing ability from the towers and change the Pathing – Pathing Prevented By to nothing. That allows your Undead tower to be built on grass, not on blight.

Zoom (requires log in)

Also, set the Stats - Food Produced to 0

Zoom (requires log in)

Finally, for eye candy, change the model and icon to something you like.

Now, how can I add special feature to a tower, like slowing ice attack, poison?

Copy paste your newly made tower and change its name to Frost Tower. Then find its abilities field and add Frost attack.

Zoom (requires log in)

TIP: You can convert hero spells to unit spell and add them to the towers also.

If you use spells, which pause the creeps, like bash, then remove attacks from creeps, so that they don’t attack your towers, if they have been paused and the unpaused.

Step 2 – Tower Upgrades

Upgrading Towers in a Team Defence is a must. Firstly, select your Spirit Tower can copy paste it 2 times. Now rename the just CnP’d Towers to Spirit Tower level 2 and 3. Raise their attack damage and lower their cooldown accordingly, to justify the upgrading cost. Higher level towers are usually better than lower level towers, right? Now locate your Spirit Tower level 1’s Techtree – Upgrades To field and add Spirit Tower level 2 there. Now do the same process for the level 2 tower, only add Spirit Tower level 3.

Zoom (requires log in)

TIP: You can make towers, which allows you to choose from various upgrades. Example, a Siege Tower, which can upgrade to level 2 Siege Tower or to a Archer Tower.

Step 3 – Building Towers

Because you made custom units, you need to change the Techtree- Structures Built field for your builder. Add the Frost Tower and only the Level 1 Spirit Tower. You don’t want players to build level 10 towers from the beginning, do You? If you have made any other towers, add them too.

Zoom (requires log in)

The second thing, which you need to change for the towers is the is the Stats - Gold Cost. Ill change the gold cost of Spirit Tower to 90 gold and remove the lumber cost. Then ill make my level 2 Spirit Tower cost 145 and level 3 cost 230 coins.

Zoom (requires log in)

NOTE: If you want, you can have both – the gold and the lumber cost in your TD. But you have to make sure, that you add lumber bounty to your creeps. (Explained in step 4.)

The final thing that you need to change is the building time. In a melee game, Spirit Towers take 35 seconds to build. That is too long, furthermore, if a new level starts in 30 seconds. Change the building time to 5 seconds. For the level 2 change it to 6 seconds and for level 3, change it to 7 seconds.

Zoom (requires log in)

Step 4 - Modifying creeps

After finished making towers, proceed with creeps. Start by changing the the Hit Points of your creeps. In the beginning, creeps should have low life and armor because nobody doesn’t want to play your TD if they can’t beat the first level!

I choosed footman to be the level 1 creep for my TD. Now, if I remember correctly, the Spirit Tower which we made, had 16 damage. I’ll give my footman 3 times that many lives, 48 lives. Make the creeps stronger with every level. Example, I gave footman 48 lives, the next level creep has 96 lives, then 192 lives.

Zoom (requires log in).

Also, I lowered the defence of the footman, and raised for the other levels a little bit.

Note: 1 armor gives a unit 5,6% more HP. Example, if you have a unit with 100 lives and 10 armor, then he acts like he has 156 HP.

Zoom (requires log in)

Balancing is hard and takes time, it difficult tell how to balance, because you have to bear in mind your tower damages and special features, ect.

To prevent the creeps attacking your towers, remove their ability to attack.

Zoom (requires log in)

Finally, you can modify the bounty the creeps give. Find the Stats - Gold Bounty Awarded base, dice and side. The same formula applies here as with the damage base, side and dice. (If you want to add lumber bounty, change the Stats - Lumber Bounty Awarded base, side and cide.)

Zoom (requires log in)

Zoom (requires log in)

Zoom (requires log in)

Note: You can spice up your TD with special creeps. For example, very slow but very strong creeps, creeps, that cast spells on themselves, flying creeps ofcourse. If you are planning to make a boss in your TD, I suggest giving him more lives and armor.
Attached Images
File type: jpg1Requirements.jpg (7.9 KB)
File type: jpg2Prevented.jpg (9.8 KB)
File type: jpg3Abilities.jpg (7.2 KB)
File type: jpg4Upgradesto.jpg (7.8 KB)
File type: jpg5Structures.jpg (7.9 KB)
File type: jpg6Goldcost.jpg (7.7 KB)
File type: jpg7_lumbercost.jpg (7.9 KB)
File type: jpg8Buildtime.jpg (7.8 KB)
File type: jpg(9Foodproduced).jpg (8.1 KB)
File type: jpg10hp.jpg (9.2 KB)
File type: jpg11armorbase.jpg (8.2 KB)
File type: jpg12attacks.jpg (8.6 KB)
File type: jpg13goldbounty.jpg (19.0 KB)
File type: jpg13goldbountystats.jpg (21.3 KB)
File type: jpg14_lumberbounty.jpg (21.9 KB)
File type: jpgExcel6.jpg (19.2 KB)
09-16-2006, 04:01 PM#3
Andrewgosu
PART III
Triggering


Map initializiation triggers
Creating players their builders
Spawning the creeps
Issuing the spawned creeps to move
Counting kills
Winning trigger
Final Touch


If a trigger contains variables, I bring out the variable type before the trigger.

Step 1 – Map initializiation triggers

When you have decided the creeps for your TD, start setting them into variables.

PlayerIngame – Player Group Variable
Creep_Array – Unit-Type Array


Trigger:
Variable Initialization
Collapse Events
Map initialization
Conditions
Collapse Actions
-------- We need these variables for later. Makes life easier. --------
Set Player_Ingame = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)))
-------- Change these and continue setting your creeps into arrays. --------
Set Creep_Array[1] = Footman
Set Creep_Array[2] = Knight
Set Creep_Array[3] = Rifleman
Set Creep_Array[4] = Gryphon Rider
Set Creep_Array[5] = Paladin
-------- Visibility --------
Visibility - Disable fog of war
Visibility - Disable black mask
-------- Turn bounty on for the "bad guys" --------
Player - Turn Gives bounty On for Player 12 (Brown)

Step 2 – Creating players their builders

Alot of beginner TD’s have preplaced builders, meaning every time you start a map, a player has a builder, even if the player isn’t in the game. To give only the players, who are playing, a builder, create the following trigger, using the player group variable, what you made before.

Trigger:
Elapsed time 00
Collapse Events
Time - Elapsed game time is 0.00 seconds
Conditions
Collapse Actions
Collapse Player Group - Pick every player in Player_Ingame and do (Actions)
Collapse Loop - Actions
Unit - Create 1 Builder for (Picked player) at ((Picked player) start location) facing Default building facing degrees
-------- Set it to your gold value --------
Player - Set (Picked player) Current gold to 225

Step 3 – Spawning the creeps

There are alot of creep spawning triggers. I will make one, which uses food count and some variables to spawn automatically the creeps for every level. First create a spawning point region for player red. (Later create one for everyone). Then, place the starting location on top of it. (You need the starting location on top if it, because I am going to use the starting location in the spawning trigger loop.)

Zoom (requires log in)

Creep Count – Integer Variable
Timer_Variable – Timer Variable
Timer_Window – Timer Window Variable
Gold_income - Integer Variable


Trigger:
Spawn Initialization
Collapse Events
Time - Elapsed game time is 10.00 seconds
Player - Player 12 (Brown)'s Food used becomes Equal to 0.00
Conditions
Collapse Actions
Set Creep_Level_Count = (Creep_Level_Count + 1)
-------- bonus gold for players, optional --------
-------- Provides additiondal gold at the beginning of each level --------
Set gold_income = (gold_income + 10)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Creep_Level_Count Equal to 6
Collapse Then - Actions
-------- Creep count in this condition must be bigger by 1 than the max number of levels --------
-------- you are going to spawn. --------
Wait 2.00 seconds
Collapse Player Group - Pick every player in Player_Ingame and do (Actions)
Collapse Loop - Actions
Game - Victory (Picked player) (Show dialogs, Show scores)
Collapse Else - Actions
-------- Creep Count helps to spawn the right creep --------
Countdown Timer - Create a timer window for Timer_Variable with title Next Wave In
Countdown Timer - Start Timer_Variable as a One-shot timer that will expire in 30.00 seconds
Set Timer_Window = (Last created timer window)
Countdown Timer - Show Timer_Window
Collapse Player Group - Pick every player in Player_Ingame and do (Actions)
Collapse Loop - Actions
Player - Add gold_income to (Picked player) Current gold
This trigger first creates a timer and lets players know how much time is left until the next wave starts. It sets the win count and creep count +1.

Trigger:
Spawn Creeps
Collapse Events
Time - Timer_Variable expires
Conditions
Collapse Actions
-------- Need to destroy the timer windows, so it doesnt start another one at the same time the next time it starts --------
Countdown Timer - Destroy Timer_Window
-------- set the number 12 to the number how much creeps you want to spawn each time. --------
Collapse For each (Integer A) from 1 to 12, do (Actions)
Collapse Loop - Actions
Wait 1.00 seconds
Collapse Player Group - Pick every player in Player_Ingame and do (Actions)
Collapse Loop - Actions
-------- Do not move the player starting positions unless you edit the terrain. --------
-------- Used in this loop. --------
Unit - Create 1 Creep_Array[Creep_Level_Count] for Player 12 (Brown) at ((Picked player) start location) facing Default building facing degrees
When the timer expires, it spawns the creeps. If the conditions are met, it runs the boss spawn (optional, check out the demo map for more info). One the creeps are spawned and dead, the previous trigger starts again, starting a timer. (So its like in a circle, Create timer>wait>timer expires=creep spawn>creeps are dead> Start the timer)

Step 4 – Issuing the spawned creeps to move

Zoom (requires log in)

To make the spawned creep move from the spawning point to another point, you need to create regions, aka checkpoints in a TD. Then you have to order your spawned creeps to move from the spawning point to the checkpoint, using the trigger below.

Trigger:
Red spawning point
Collapse Events
Unit - A unit enters Red spawning point <gen>
Collapse Conditions
(Owner of (Triggering unit)) Equal to Player 12 (Brown)
Collapse Actions
Unit - Order (Triggering unit) to Move To (Center of checkpoint <gen>)
The condition is needed to issue only the player brown (Bad guy) creeps to move to the checkpoint.

Trigger:
Checkpoint
Collapse Events
Unit - A unit enters checkpoint <gen>
Collapse Conditions
(Owner of (Triggering unit)) Equal to Player 12 (Brown)
Collapse Actions
Unit - Order (Triggering unit) to Move To (Center of checkpoint 2 <gen>)

Step 5 – Setting the „lives”


Almost all TD’s use „lives”. First of all, make a „endpoint” region. Then, you need to create a leaderboard. Rather than adding all players to the leaderboard, add the players, who are playing the game to the leaderboard.

Lives – Integer Variable, Initial value 10

Trigger:
Create Leaderboard
Collapse Events
Time - Elapsed game time is 0.00 seconds
Conditions
Collapse Actions
Leaderboard - Create a leaderboard for Player_Ingame titled Kill Count
Collapse Player Group - Pick every player in Player_Ingame and do (Actions)
Collapse Loop - Actions
Leaderboard - Add (Picked player) to (Last created leaderboard) with label (Name of (Picked player)) and value 0
Leaderboard - Add Player 12 (Brown) to (Last created leaderboard) with label Lives Left and value Lives_amount
Leaderboard - Show (Last created leaderboard)
Now to the part where you loose your lives. Usually, every time a player leaks, one life is taken away and when the lives reach zero, defeat all players.

Trigger:
Lose Lives
Collapse Events
Unit - A unit enters Endpoint <gen>
Collapse Conditions
(Owner of (Entering unit)) Equal to Player 12 (Brown)
Collapse Actions
Unit - Kill (Entering unit)
Set Lives_amount = (Lives_amount - 1)
-------- You need to update the leaderboard every time a player leaks --------
Leaderboard - Change the value for Player 12 (Brown) in (Last created leaderboard) to Lives_amount
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Lives_amount Equal to 0
Collapse Then - Actions
Wait 2.00 seconds
Collapse Player Group - Pick every player in Player_Ingame and do (Actions)
Collapse Loop - Actions
Game - Defeat (Picked player) with the message: Defeat!
Else - Actions

Step 5 – Counting kills

For counting player’s kills, we use the same leaderboard. It is very annoying to create a trigger for every player, just to count the kills. Lets leave that option and do that in one trigger.

Kills_Count
– Integer Array. Initial value should be the number of players you have in your TD.
Trigger:
Keep track of kills
Collapse Events
Unit - A unit Dies
Collapse Conditions
(Owner of (Dying unit)) Equal to Player 12 (Brown)
Collapse Actions
Set Kills_Count[(Player number of (Owner of (Killing unit)))] = (Kills_Count[(Player number of (Owner of (Killing unit)))] + 1)
-------- You need to update the leaderboard every time a player kills a bad guy --------
Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to Kills_Count[(Player number of (Owner of (Killing unit)))]
Leaderboard - Sort (Last created leaderboard) by Value in Descending order

Final Touch

If a player leaves you have to remove him/her from the Player_ingame. Also you can set [left] behind his/her name and remove all the left players' buildings. (Repeat for each player)

Trigger:
Player Red Leaves
Collapse Events
Player - Player 1 (Red) leaves the game
Conditions
Collapse Actions
Leaderboard - Change the label for Player 1 (Red) in (Last created leaderboard) to ((Name of Player 1 (Red)) + [left])
Player Group - Remove Player 1 (Red) from Player_Ingame
-------- Removes all red buildings. --------
Custom script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 1 (Red)) and do (Actions)
Collapse Loop - Actions
Unit - Remove (Picked unit) from the game

It is useful, when players have the ability to sell the built towers. Its quite easy to do that.

Firstly, make a dummy spell which requires no target unit nor point (like thunderclap). I will base it off item area healing (But channel will do, too). Then ill change the fields all to do nothing and the icon to something nice, like gold ring. Now add the ability to all of the towers.

Then, locate your towers point values.

Zoom (requires log in)

Now, for example, the first level Spirit tower in the demo map costs 135 coins. The point value has to be the same. The seconds level costs 145 coins, so now, you have to add the first point value to the seconds one, 135+145=280. Finally, the level 3 tower costs 230 coins, so you have to set the point value to 280+230=510. That makes sure that you get 50% of the money back which you spent on upgrading and building not the 50% of the money you spent on the last upgrade.

Finally, to sell the tower, make this trigger.

Trigger:
Sell Function
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Sell Tower
Collapse Actions
-------- You can change the divide part, diving it by 2 will give back 50% of the cost --------
-------- E.g Diving it by 4 will give back 25% of the cost --------
Player - Add ((Point-value of (Casting unit)) / 2) to (Owner of (Casting unit)) Current gold
Unit - Remove (Casting unit) from the game

A trigger which removes the corpses to reduce lagg. You need to call a local. (Use a custom script for that)

Trigger:
Corpse Clean up
Collapse Events
Unit - A unit Dies
Conditions
Collapse Actions
Custom script: local unit udg_dying_unit
Set dying_unit = (Dying unit)
Wait 5.00 seconds
Unit - Remove dying_unit from the game

If you want, you can apply a kick system for your TD. (Im using player red as the player with the ability to kick, altough I dont encourage kicking players)

Trigger:
Player Blue is kicked
Collapse Events
Player - Player 1 (Red) types a chat message containing -kick blue as An exact match
Conditions
Collapse Actions
Game - Defeat Player 2 (Blue) with the message: You have been kicke...
Leaderboard - Change the label for Player 2 (Blue) in (Last created leaderboard) to ((Name of Player 2 (Blue)) + [Kicked])
Player Group - Remove Player 2 (Blue) from Player_Ingame
Custom script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 2 (Blue)) and do (Actions)
Collapse Loop - Actions
Unit - Remove (Picked unit) from the game

Team Defence Template BETA 1.2 includes
  • Template Towers
  • Triggers from spawning creeps to counting kills
  • Symmetrical terrain
  • 1-8 player playability
  • No lagg causing periodic events
  • Kick trigger
  • Plus, its easy to manipulate and change it.

Happy map making. Feedback appriciated.
Attached Images
File type: jpgSpawn.jpg (76.4 KB)
File type: jpgSpawn_Moving.jpg (52.1 KB)
File type: jpg3pointvalue.jpg (7.8 KB)
Attached Files
File type: w3xTeam Defence Template BETA 1.2.w3x (73.3 KB)
09-16-2006, 04:44 PM#4
DeaD_MeN_WalkiN
Haven't read it all yet seeing it's long, Though it seems you put about 2 hours of typing only (not including the planning part), Hope this gets approved.
09-16-2006, 10:26 PM#5
Av3n
Pretty neat man!
09-16-2006, 11:08 PM#6
Knights
As before, it's good. =) (Before is TH.net)
09-17-2006, 01:45 AM#7
HernanG
Very useful, and simple to understand. good job
09-18-2006, 08:41 PM#8
PitzerMike
Please attach the images to your posts instead of linking to off-site sources. Otherwise this can't be approved.

And believe me, I really want to approve this!
Good work
09-19-2006, 12:59 PM#9
Andrewgosu
Quote:
Originally Posted by PitzerMike
Please attach the images to your posts instead of linking to off-site sources. Otherwise this can't be approved.

Can be done.

EDIT:

Hosted the images here, edited the 3 posts.
09-21-2006, 07:53 AM#10
Archian
Good tutorial, i like it =)

Off-topic question:
Does this mean that I can't submit my HUGE tower defense tutorial (which includes even more) plus a free TD template ??
09-21-2006, 09:06 AM#11
Andrewgosu
Quote:
Originally Posted by Archian
Off-topic question:
Does this mean that I can't submit my HUGE tower defense tutorial (which includes even more) plus a free TD template ??

You could graveyard this and approve yourown tutorial
09-21-2006, 09:56 AM#12
PhoenixFeather
No, keep both. The more, the better.
09-27-2006, 09:32 AM#13
PitzerMike
Quote:
Originally Posted by PhoenixFeather
No, keep both. The more, the better.

I agree, we can always have more tutorials on the same topic when they're well written. People have different tastes and some might prefer your tutorial.

Oh, and this is approved.
09-28-2006, 12:53 PM#14
abriko
Team Defense ? It's not a Tower Defense ?
09-28-2006, 04:16 PM#15
Andrewgosu
Quote:
Originally Posted by abriko
Team Defense ? It's not a Tower Defense ?

Basically the same, I think. Actually a Team Tower Defence should fit it the most.