I’m making a mode where the players have a limited number of lives and there is some HUD text displaying how many lives each player has. Currently the color is static, but I want it to change depending on how many lives you have left (e.g. 5 is blue, 4 is green, 3 is yellow, etc.). Does anyone know how to do something like that?
variables
{
player:
0: LivesRemaining
}
rule("Life HUD Team 1")
{
event
{
Ongoing - Global;
}
actions
{
Create HUD Text(All Players(Team 1), Custom String("{2} {0} Lives Remaining: {1}", Hero Icon String(Hero Of(Players In Slot(0,
Team 1))), Players In Slot(0, Team 1).LivesRemaining, Players In Slot(0, Team 1)), Null, Null, Left, 0, Color(Blue), Color(
White), Color(Blue), Visible To and String, Default Visibility);
Create HUD Text(All Players(Team 1), Custom String("{2} {0} Lives Remaining: {1}", Hero Icon String(Hero Of(Players In Slot(1,
Team 1))), Players In Slot(1, Team 1).LivesRemaining, Players In Slot(1, Team 1)), Null, Null, Left, 0, Color(Blue), Color(
White), Color(Blue), Visible To and String, Default Visibility);
Create HUD Text(All Players(Team 1), Custom String("{2} {0} Lives Remaining: {1}", Hero Icon String(Hero Of(Players In Slot(2,
Team 1))), Players In Slot(2, Team 1).LivesRemaining, Players In Slot(2, Team 1)), Null, Null, Left, 0, Color(Blue), Color(
White), Color(Blue), Visible To and String, Default Visibility);
Create HUD Text(All Players(Team 1), Custom String("{2} {0} Lives Remaining: {1}", Hero Icon String(Hero Of(Players In Slot(3,
Team 1))), Players In Slot(3, Team 1).LivesRemaining, Players In Slot(3, Team 1)), Null, Null, Left, 0, Color(Blue), Color(
White), Color(Blue), Visible To and String, Default Visibility);
Create HUD Text(All Players(Team 1), Custom String("{2} {0} Lives Remaining: {1}", Hero Icon String(Hero Of(Players In Slot(4,
Team 1))), Players In Slot(4, Team 1).LivesRemaining, Players In Slot(4, Team 1)), Null, Null, Left, 0, Color(Blue), Color(
White), Color(Blue), Visible To and String, Default Visibility);
}
}
rule("Life HUD Team 2")
{
event
{
Ongoing - Global;
}
actions
{
Create HUD Text(All Players(Team 2), Custom String("{2} {0} Lives Remaining: {1}", Hero Icon String(Hero Of(Players In Slot(0,
Team 2))), Players In Slot(0, Team 2).LivesRemaining, Players In Slot(0, Team 2)), Null, Null, Left, 0, Color(Blue), Color(
White), Color(Blue), Visible To and String, Default Visibility);
Create HUD Text(All Players(Team 2), Custom String("{2} {0} Lives Remaining: {1}", Hero Icon String(Hero Of(Players In Slot(1,
Team 2))), Players In Slot(1, Team 2).LivesRemaining, Players In Slot(1, Team 2)), Null, Null, Left, 0, Color(Blue), Color(
White), Color(Blue), Visible To and String, Default Visibility);
Create HUD Text(All Players(Team 2), Custom String("{2} {0} Lives Remaining: {1}", Hero Icon String(Hero Of(Players In Slot(2,
Team 2))), Players In Slot(2, Team 2).LivesRemaining, Players In Slot(2, Team 2)), Null, Null, Left, 0, Color(Blue), Color(
White), Color(Blue), Visible To and String, Default Visibility);
Create HUD Text(All Players(Team 2), Custom String("{2} {0} Lives Remaining: {1}", Hero Icon String(Hero Of(Players In Slot(3,
Team 2))), Players In Slot(3, Team 2).LivesRemaining, Players In Slot(3, Team 2)), Null, Null, Left, 0, Color(Blue), Color(
White), Color(Blue), Visible To and String, Default Visibility);
Create HUD Text(All Players(Team 2), Custom String("{2} {0} Lives Remaining: {1}", Hero Icon String(Hero Of(Players In Slot(4,
Team 2))), Players In Slot(4, Team 2).LivesRemaining, Players In Slot(4, Team 2)), Null, Null, Left, 0, Color(Blue), Color(
White), Color(Blue), Visible To and String, Default Visibility);
}
}