HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Lives in LeaderBoard + Killing Spree

01-02-2007, 07:25 PM#1
mikke95
How to display lives in a leaderboard

Welcome to my tutorial!
In this i am going to show you how to display Lives in a Leaderboard.
This is very useful for TD's.


Ok first we need 2 variables.
We are first going to make the Leadeboard variable.

Step - 1 The Variables

Hit Ctrl + B and then is a new window showing up,
that window is the variable window.
We are going to make 2 variables now, hit Ctrl + N
And make the variable with these settings,
Name it Leaderboard, and set the variable type to ''Leaderboard''
with the normal settings.

Now is the leaderboard Variable done, we shall now make the Lives variable.

Hit CTRL + N again and make a new variable, new it Lives and set the
variable type to ''Integer'' with the normal settings..


Step 2 - The Triggers

We need 2 Triggers to make this work so listen up! =)

Create a new trigger, and name it ''Leaderboard''
And create 1 more trigger and name it ''Loose lives''

Now for the event in ''Leaderboard''

We are going to make it after 0 seconds because the ''Map Intialialization'' event
doesn't work for leaderboards i don't know why but what ever.
BACK TO TOPIC: The event shall be ''Time - Elapsed game time is 0 sec''
We don't need any conditions for this trigger so now lets jump over to the actions!

As for the actions we start with this,
Go set the variable ''Set Variable'' to Set Lives = 30 or what you want the live amount to be.

And now we need to actually make the leaderboard, go to actions and make a new leaderboard '' Leaderboard - Create ''
Create a Leaderboard for all players and name it Lives with the value
Lives.

And now we need to set the first variable we made to the last created leaderboard.
Set: LeaderBoard = Las created leaderboard.

And we need to set a player into it if it shall be team lives
we just take Red,

Leaderboard - Add Player,
Add Player 1(RED) to Leaderboard with label Lives and value Lives.
Leaderboard - Hide/Show.
Show Leaderboard.

Trigger:
LeaderBoard
Collapse Events
Time - Elapsed game time is 0.00 seconds
Conditions
Collapse Actions
Set Lives = 30
Leaderboard - Create a leaderboard for (All players) titled Lives
Set Leaderboard = (Last created leaderboard)
Leaderboard - Add Player 1 (Red) to Leaderboard with label Lives and value Lives
Leaderboard - Show Leaderboard

That was the first trigger, we are almost done!



Step 3 - The last trigger.

We need to make the ''Loose Lives'' trigger.
If this is for a tower defense, we will use the event ''A unit enters (REGION)''

Now for condition: Player Comparison - Owner of Entering Unit qual to Player 12 (BROWN).
Assuming that the spawned unit are owned by player 12.

As before in the first trigger we set Lives = 30 but for now we need to make the integer being lower when some body is entering.

Set Lives = Lives - 1.
As always in TD's when you leak and loose lives a text is appearing
so you know you leak cause if you're using invi levels.

Game - Text Message (Explicity Timed)
To all players, for 5 sec(or more i am just using 5..)
WARNING + Concentrate Strings: (some space) + Concentrate Strings:
String(Lives) + LEFT!.

Now a text should appear if you leak.
Leaderboard = Change the value for Player 1(RED) in Leaderboard to Lives.
If All conditions are true then do then actions else do Else actions.
Condition : Integer:
Lives equal to 0.

Now for the then Actions!
Now make a text like before just set it to ''You lost..''
And now:
Player Group: Pick every units in All players and do Actions.
Game - Defeat Picked Player with the message: No Lives left!
Else Actions: do nothing..

Trigger:
Loos Live
Collapse Events
Unit - A unit enters Lives <gen>
Collapse Conditions
(Owner of (Entering unit)) Equal to Player 12 (Brown)
Collapse Actions
Set Lives = (Lives - 1)
Unit - Kill (Entering unit)
Game - Display to (All players) for 5.00 seconds the text: (WARNING! + ( + ((String(Lives)) + LEFT!)))
Leaderboard - Change the value for Player 1 (Red) in Leaderboard to Lives
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Lives Equal to 0
Collapse Then - Actions
Game - Display to (All players) for 30.00 seconds the text: You lost..
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop - Actions
Game - Defeat (Picked player) with the message: You lost all your l...
Collapse Else - Actions
Do nothing


How to make a Killing Spree System

The variables

I have made 2 variables for the system, first we need the points!
Press CTRL + B. Make a new variable, name it KillPoints and set it to
Integer, + array 1.
The second variable. I name it Spree, set it as a string
and set the array to 1.

The unit is killed trigger

First we need to make the Event!
Event - go to Generic Unit Event and set it to A unit dies.

Make 2 new Actions.
Set Variable, Set KillPoints[Player Number owner of dying unit] = 0
Set Variable, KillPoint[Player number owner of killing unit] = KillPoint[the same as before] + 1,

If all Conditions are true then do then actions else do else actions

Now for the Killing Spree!
Condition - Go to Integer, and set it to KillPoints[Player number owner of killing unit] Equal to 3.

Now for a text that says the killer is on a killing spree!
Action: Game -Text Message (Explicity Timed)

Set it to All players and 8 seconds and the text shall be
Concernate Strings, set it to
Player - Playe name : Owner of killing unit.
+
Is on a KILLING SPREE!

Now set the variable for the string.
Set Variable - Set Spree [Player number of owner of killing unit]
= Killing Spree!


And then go on do copy'n'paste the If all conditions are true then do Then Actions else do Else Actions, and set the amount of Kill points to some more and change the text to etc. God like! and set the spree to God Like!

Trigger:
Killing Spree
Collapse Events
Unit - A unit Dies
Conditions
Collapse Actions
Set KillPoints[(Player number of (Owner of (Dying unit)))] = 0
Set KillPoints[(Player number of (Owner of (Killing unit)))] = (KillPoints[(Player number of (Owner of (Killing unit)))] + 1)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
KillPoints[(Player number of (Owner of (Killing unit)))] Equal to 3
Collapse Then - Actions
Game - Display to (All players) for 8.00 seconds the text: ((Name of (Owner of (Killing unit))) + is on a KILLING SPREE!)
Set Spree[(Player number of (Owner of (Killing unit)))] = Killing Spree!
Sound - Play Killing_Spree <gen>
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
KillPoints[(Player number of (Owner of (Killing unit)))] Equal to 5
Collapse Then - Actions
Game - Display to (All players) for 8.00 seconds the text: ((Name of (Owner of (Killing unit))) + is RAMPAGE)
Set Spree[(Player number of (Owner of (Killing unit)))] = RAMPAGE!
Sound - Play rampage <gen>
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
KillPoints[(Player number of (Owner of (Killing unit)))] Equal to 7
Collapse Then - Actions
Game - Display to (All players) for 8.00 seconds the text: ((Name of (Owner of (Killing unit))) + UNSTOPABLEEE!)
Set Spree[(Player number of (Owner of (Killing unit)))] = UNSTOPABLE!!
Sound - Play Unstoppable <gen>
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
KillPoints[(Player number of (Owner of (Killing unit)))] Equal to 9
Collapse Then - Actions
Game - Display to (All players) for 8.00 seconds the text: ((Name of (Owner of (Killing unit))) + is WICKED SICK!!)
Set Spree[(Player number of (Owner of (Killing unit)))] = Wicked SICK!!
Sound - Play wickedsick <gen>
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
KillPoints[(Player number of (Owner of (Killing unit)))] Equal to 12
Collapse Then - Actions
Game - Display to (All players) for 8.00 seconds the text: ((Name of (Owner of (Killing unit))) + is GOD LIKE!!!!)
Set Spree[(Player number of (Owner of (Killing unit)))] = God Like!!!
Sound - Play GodLike <gen>
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
KillPoints[(Player number of (Owner of (Killing unit)))] Greater than 12
Collapse Then - Actions
Game - Display to (All players) for 8.00 seconds the text: ((Name of (Owner of (Killing unit))) + HOLY SHIIIT!)
Set Spree[(Player number of (Owner of (Killing unit)))] = HOLY SHIT!
Sound - Play holyshit <gen>
Collapse Else - Actions
Do nothing


That was all hope these tutorials was helpfull!
Made by: mikke95
01-02-2007, 07:33 PM#2
ragingspeedhorn
You need to actually write the triggers in trigger tags, not have them as pictures, read the rules.
01-03-2007, 11:40 AM#3
mikke95
ok sry
I will do that in my next tut
01-03-2007, 12:44 PM#4
ragingspeedhorn
Well, you can't get it into this tutorial database then.
01-03-2007, 04:06 PM#5
mikke95
Then i will try to fix it! :)
EDIT: DONE, AND DEMO MAP
01-03-2007, 07:47 PM#6
Anopob
You should copy + paste trigger text into the trigger tags, it's much easy to read and now it has white random boxes etc.
01-04-2007, 03:04 PM#7
mikke95
how..?
01-04-2007, 03:36 PM#8
ragingspeedhorn
Copy as text -> paste into trigger tags.
01-04-2007, 04:30 PM#9
mikke95
So how do i copy it as a text?!
01-04-2007, 05:17 PM#10
WILL THE ALMIGHTY
try right clicking the white box over your events.
01-04-2007, 05:19 PM#11
ragingspeedhorn
Are you stupid or something? Go into your trigger, right-click the stuff in the top of it where it's name is and click copy as text.
01-04-2007, 06:10 PM#12
mikke95
Done and thank you ^^
01-05-2007, 05:05 PM#13
PitzerMike
Ok, I've worked a bit over it, fixed spelling errors, formatted some headings and so on. Approved.
01-05-2007, 08:38 PM#14
mikke95
thanks!
01-24-2007, 12:33 PM#15
DurotarLord
Quote:
Originally Posted by ragingspeedhorn
Are you stupid or something? Go into your trigger, right-click the stuff in the top of it where it's name is and click copy as text.

dude, what was that for? we all gotta learn sometime.