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.
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..
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!
That was all hope these tutorials was helpfull!
Made by:
mikke95