IceDevil9
BattleForums Senior Member
Since so many people seem to be wanting to make TDs heres a list of basic TD stuff.
Creating A Dialog
You will need to make a couple of variables. Here are the ones we will be using for our example.
Name: EasyDiff
Type: Dialog Button
Initial Value: -None-
Name: MediumDiff
Type: Dialog Button
Initial Value: -None-
Name: HardDiff
Type: Dialog Button
Initial Value: -None-
Name: Lives
Type: Integer
Initial Value: 0
Name: DiffChooser
Type: Dialog
Initial Value: Default
Next you will need to execute a trigger to set-up the Dialog
Events
Map Initilization
Coniditions
Player Slot Status Comparison- Player 1(Red) Slot Status Equal To Is Playing
( ^ Completely Optional)
Actions
Dialog-Create Dialog Button- Create a dialog button for DiffChooser Labeled Easy
Set Variable - Set EasyDiff to (Last Created Dialog Button)
Dialog-Create Dialog Button-Create a dialog button for DiffChooser Labeled Medium
Set Variable - Set MediumDiff to (Last Created Dialog Button)
Dialog-Create Dialog Button-Create a dialog button for DiffChooser Labeled Hard
Set Variable - Set HardDiff to (Last Created Dialog Button)
Dialog-Show/Hide- Show DiffChooser for Player1(Red)
Here is how you set lives after a button is clicked. Let's say Easy is 40 lives. Use this trigger.
Events
Dialog-Dialog Button Click- A dialog button is clicked for DiffChooser
Conditions
Dialog Button Comparison- (Clicked Dialog Button) Is Equal To EasyDiff
Actions
Set Variable- Set Lives to 40
Dialog- Show/Hide- Hide DiffChooser for Player1(red)
Use that same trigger for different difficulties, substituting the number of lives corresponding to how many you wish to have for that difficulty.
Creating Units and Having Them Move
This is essential for any TD. This is how you will get your units to move. You will need to create a couple regions. Here are ours, for this example.
'Spawn1'
'Move1'
'Move2'
'Lives'
You also need to create a timer, and set it.
Correspondeing to the above trigger, a good way to do this is, after the lives are set, add
Trigger-Run (Checking Conditions) Enemy Spawn 1
Then you must create a couple variables. Here are ours for the example.
Name: LvlTimer
Type: Timer
Initial Value: -None-
Name: MonsterType
Type: Unit-Type
Initial Value: -None-
Name: MonsterAmount
Type: Integer
Initial Value: -None-
Name: LvlNumber
Type: Integer
Initial Value: 1
Now we must set our timer. Here is our basic trigger to do that. We can set a couple of actions, but I usually leave this trigger as named 'Beggening Timer' and have it run using the previous dialog triggers. This will be done as such.
Events
None
Coniditions
None
Actions
Countdown Timer- Set LvlTimer as a Repeating timer that will expire in 45.00 seconds
Game-Text Message (Explicitly Timed)- Display to (All Players) for 20.00 seconds the text: 1st level will start in 45 seconds
Now we need to actually start the levels, there are a couple of things we need to do. First we need to set all the levels. This trigger is set to 'Initially Off', which means you need to uncheck the box that says intially on. This can be done as follows. There will be no actions or conditions, as you will find out a little later in this section of our lesson, we will call on this trigger using another trigger. I will be using just fake units. anything inside the trigger in Italics is a fake name, and can be replaced with whatever you choose. Ok, here it is:
Events
None
Coniditions
None
Actions
If/Then/Else- If LvlNumber Is Equal To 1, Then Set Variable(Set MonsterType = Scouts), Else (Do Nothing)
If/Then/Else-If LvlNumber Is Equal To 1, Then Set Variable(Set MonsterAmount = 30), Else (Do Nothing)
What you then do is repeat that trigger above, replacing the LvlNumber by one each time and replacing MonsterType. MonsterAmount is fine, unless you are doing bosses or something, and wish to change it.
Before we get the units moving, we need to set move triggers.
Events
Unit-Unit Enters Region-Unit Enters Enemy Spawn 1
Conditions
Player Comparison- (Owner Of (Entering Unit) Equal To Player 12
Actions
Unit-Issue Order Targetting A Point-Order (Event Response-Entering region) to Move To (Center Of (Move 1))
Now, you need to copy + paste that trigger, and change 'Enemy Spawn 1' and 'Move 1' To 'Move 1' and 'Move 2' (Or whatever your next move is.
Next we need to show what to do after the timer runs out.
Events
Time- Timer Expires- LvlTimer expires.
Coniditions
None
Actions
Countdown Timer- Pause Timer- Pause (Event Response-Expiring Timer)
Trigger- Run (Checking Conditions)-Run Set Levels Our previous trigger where we set all the levels
Unit-Create Units Facing Angle- Create MonsterAmount MonsterType at (Center Of(Enemy Spawn 1) facing Default Building Facing Degrees
Unit Group- Pick Every Unit In Unit Group And Do Action- Pick Every Unit In (Units In (Enemy Spawn 1)) And do Unit Group- Issue Order Targetting A Point-Order (Units In (Enemy Spawn 1)) to Move To (Center Of (Move 1))
Game-Text Message (explicitly Timed)-Display to (All Players) for 20.00 seconds the message: Level 1- Scouts
Set Variable- Set LvlNumber = (Aritchmetic- LvlNumber+1)
Next we need to reset the timer.
Events
Player-Properties- Player 12's Food Used Becomes Less Than or Equal To 0.00
Conditions
None
Actions
Countdown Timer- Set LvlTimer As A Repeating Timer set to expire in 30.00 seconds.
Finally we need to set the losing a lives trigger.
Events
Unit-Unit Enters Region-A Unit Enters Lives
Conidtions
Player Comparison-Owner of (Entering Unit) Equal To Player 12
Actions
Set Variable- Set Lives = (Lives - 1)
Here is the final losing trigger.
Events
None
Coniditions
None
Actions
If/Then/Else- If (Integer Comparison-LvlNumber Equal To 0) Then (Game-Defeat-Defeat Player 1(Red) With message You lose!), Else (Do Nothing)
Copy + Paste that trigger and substitute Player 1(Red) with all your defenders.
Setting Up A Leaderboard
Ok, phew, now that we have moving triggers out of the way, lets move onto Leaderboards. Yes, those fancy leaderboards. Here is how you make them.
Events
Map Initilization
Conditions
None
Actions\
Leaderboard-Create-Creat a leaderboard for (All Players) titled Kills.
If/Then/Else- If (Player Slot Status Comparison- Player 1 (Red) Slot Status Equal To Is Playing) Then (Leaderboard- Add Player-Add Player 1(Red) to (Last Created Leaderboard) with label 'Name Of Player 1(Red)' and value of 0, Else (Do Nothing)
You need to copy + paste the 'If/Then/Else' trigger and subsitute Player 1 with player 2, Player 3, Player 4, and so on.
Here is how u add kills to your leaderboard. A bit complicated but not too hard to figure out.
You need to add a variable though.
Name: Kills
Type: Integer Array
Initial Value: 0
Events
Unit-Unit Dies- A unit owned by Player 12 dies
Conditions
Integer Comparison- Lives Is Not Equal To 0
Actions
Set Kills[Player Number Of(Owner of Killing Unit)))] = Kills[Player Number of(Oner of Killing Unit)))] + 1
Leaderboard- Change the value for (Owner of(Killing Unit)) in (Last Created Leaderboard) to Kills[Player Number Of(Owner Of(Killing Unit)))]
Leaderboard-Sort-Sort (Last Created Leaderboard) By Value In Descending Order
If a player leaves this is the trigger you need to run.
Events
Time-Periodic Event- Every 5.00 seconds of game time
Conditions
None
Actions
If/Then/Else- If (Player Slot Status Comparison Player 1(Red) Slot Status Equal To Has Left The Game), Then (Leaderboard-Change Player Label- Change the lable for Player 1(Red) in (Last Created Leaderboard) to <Quit the game>), Else (Do Nothing)
Once again, like you have done so many times before, you must copy + paste and make this for each human player.
Well, thats about all the basics you'll need to know. If you wish to know anything else, then let me know and I'll edit this post with how to do it.
-Frank
Creating A Dialog
You will need to make a couple of variables. Here are the ones we will be using for our example.
Name: EasyDiff
Type: Dialog Button
Initial Value: -None-
Name: MediumDiff
Type: Dialog Button
Initial Value: -None-
Name: HardDiff
Type: Dialog Button
Initial Value: -None-
Name: Lives
Type: Integer
Initial Value: 0
Name: DiffChooser
Type: Dialog
Initial Value: Default
Next you will need to execute a trigger to set-up the Dialog
Events
Map Initilization
Coniditions
Player Slot Status Comparison- Player 1(Red) Slot Status Equal To Is Playing
( ^ Completely Optional)
Actions
Dialog-Create Dialog Button- Create a dialog button for DiffChooser Labeled Easy
Set Variable - Set EasyDiff to (Last Created Dialog Button)
Dialog-Create Dialog Button-Create a dialog button for DiffChooser Labeled Medium
Set Variable - Set MediumDiff to (Last Created Dialog Button)
Dialog-Create Dialog Button-Create a dialog button for DiffChooser Labeled Hard
Set Variable - Set HardDiff to (Last Created Dialog Button)
Dialog-Show/Hide- Show DiffChooser for Player1(Red)
Here is how you set lives after a button is clicked. Let's say Easy is 40 lives. Use this trigger.
Events
Dialog-Dialog Button Click- A dialog button is clicked for DiffChooser
Conditions
Dialog Button Comparison- (Clicked Dialog Button) Is Equal To EasyDiff
Actions
Set Variable- Set Lives to 40
Dialog- Show/Hide- Hide DiffChooser for Player1(red)
Use that same trigger for different difficulties, substituting the number of lives corresponding to how many you wish to have for that difficulty.
Creating Units and Having Them Move
This is essential for any TD. This is how you will get your units to move. You will need to create a couple regions. Here are ours, for this example.
'Spawn1'
'Move1'
'Move2'
'Lives'
You also need to create a timer, and set it.
Correspondeing to the above trigger, a good way to do this is, after the lives are set, add
Trigger-Run (Checking Conditions) Enemy Spawn 1
Then you must create a couple variables. Here are ours for the example.
Name: LvlTimer
Type: Timer
Initial Value: -None-
Name: MonsterType
Type: Unit-Type
Initial Value: -None-
Name: MonsterAmount
Type: Integer
Initial Value: -None-
Name: LvlNumber
Type: Integer
Initial Value: 1
Now we must set our timer. Here is our basic trigger to do that. We can set a couple of actions, but I usually leave this trigger as named 'Beggening Timer' and have it run using the previous dialog triggers. This will be done as such.
Events
None
Coniditions
None
Actions
Countdown Timer- Set LvlTimer as a Repeating timer that will expire in 45.00 seconds
Game-Text Message (Explicitly Timed)- Display to (All Players) for 20.00 seconds the text: 1st level will start in 45 seconds
Now we need to actually start the levels, there are a couple of things we need to do. First we need to set all the levels. This trigger is set to 'Initially Off', which means you need to uncheck the box that says intially on. This can be done as follows. There will be no actions or conditions, as you will find out a little later in this section of our lesson, we will call on this trigger using another trigger. I will be using just fake units. anything inside the trigger in Italics is a fake name, and can be replaced with whatever you choose. Ok, here it is:
Events
None
Coniditions
None
Actions
If/Then/Else- If LvlNumber Is Equal To 1, Then Set Variable(Set MonsterType = Scouts), Else (Do Nothing)
If/Then/Else-If LvlNumber Is Equal To 1, Then Set Variable(Set MonsterAmount = 30), Else (Do Nothing)
What you then do is repeat that trigger above, replacing the LvlNumber by one each time and replacing MonsterType. MonsterAmount is fine, unless you are doing bosses or something, and wish to change it.
Before we get the units moving, we need to set move triggers.
Events
Unit-Unit Enters Region-Unit Enters Enemy Spawn 1
Conditions
Player Comparison- (Owner Of (Entering Unit) Equal To Player 12
Actions
Unit-Issue Order Targetting A Point-Order (Event Response-Entering region) to Move To (Center Of (Move 1))
Now, you need to copy + paste that trigger, and change 'Enemy Spawn 1' and 'Move 1' To 'Move 1' and 'Move 2' (Or whatever your next move is.
Next we need to show what to do after the timer runs out.
Events
Time- Timer Expires- LvlTimer expires.
Coniditions
None
Actions
Countdown Timer- Pause Timer- Pause (Event Response-Expiring Timer)
Trigger- Run (Checking Conditions)-Run Set Levels Our previous trigger where we set all the levels
Unit-Create Units Facing Angle- Create MonsterAmount MonsterType at (Center Of(Enemy Spawn 1) facing Default Building Facing Degrees
Unit Group- Pick Every Unit In Unit Group And Do Action- Pick Every Unit In (Units In (Enemy Spawn 1)) And do Unit Group- Issue Order Targetting A Point-Order (Units In (Enemy Spawn 1)) to Move To (Center Of (Move 1))
Game-Text Message (explicitly Timed)-Display to (All Players) for 20.00 seconds the message: Level 1- Scouts
Set Variable- Set LvlNumber = (Aritchmetic- LvlNumber+1)
Next we need to reset the timer.
Events
Player-Properties- Player 12's Food Used Becomes Less Than or Equal To 0.00
Conditions
None
Actions
Countdown Timer- Set LvlTimer As A Repeating Timer set to expire in 30.00 seconds.
Finally we need to set the losing a lives trigger.
Events
Unit-Unit Enters Region-A Unit Enters Lives
Conidtions
Player Comparison-Owner of (Entering Unit) Equal To Player 12
Actions
Set Variable- Set Lives = (Lives - 1)
Here is the final losing trigger.
Events
None
Coniditions
None
Actions
If/Then/Else- If (Integer Comparison-LvlNumber Equal To 0) Then (Game-Defeat-Defeat Player 1(Red) With message You lose!), Else (Do Nothing)
Copy + Paste that trigger and substitute Player 1(Red) with all your defenders.
Setting Up A Leaderboard
Ok, phew, now that we have moving triggers out of the way, lets move onto Leaderboards. Yes, those fancy leaderboards. Here is how you make them.
Events
Map Initilization
Conditions
None
Actions\
Leaderboard-Create-Creat a leaderboard for (All Players) titled Kills.
If/Then/Else- If (Player Slot Status Comparison- Player 1 (Red) Slot Status Equal To Is Playing) Then (Leaderboard- Add Player-Add Player 1(Red) to (Last Created Leaderboard) with label 'Name Of Player 1(Red)' and value of 0, Else (Do Nothing)
You need to copy + paste the 'If/Then/Else' trigger and subsitute Player 1 with player 2, Player 3, Player 4, and so on.
Here is how u add kills to your leaderboard. A bit complicated but not too hard to figure out.
You need to add a variable though.
Name: Kills
Type: Integer Array
Initial Value: 0
Events
Unit-Unit Dies- A unit owned by Player 12 dies
Conditions
Integer Comparison- Lives Is Not Equal To 0
Actions
Set Kills[Player Number Of(Owner of Killing Unit)))] = Kills[Player Number of(Oner of Killing Unit)))] + 1
Leaderboard- Change the value for (Owner of(Killing Unit)) in (Last Created Leaderboard) to Kills[Player Number Of(Owner Of(Killing Unit)))]
Leaderboard-Sort-Sort (Last Created Leaderboard) By Value In Descending Order
If a player leaves this is the trigger you need to run.
Events
Time-Periodic Event- Every 5.00 seconds of game time
Conditions
None
Actions
If/Then/Else- If (Player Slot Status Comparison Player 1(Red) Slot Status Equal To Has Left The Game), Then (Leaderboard-Change Player Label- Change the lable for Player 1(Red) in (Last Created Leaderboard) to <Quit the game>), Else (Do Nothing)
Once again, like you have done so many times before, you must copy + paste and make this for each human player.
Well, thats about all the basics you'll need to know. If you wish to know anything else, then let me know and I'll edit this post with how to do it.
-Frank