Hey guys!
I have a scripting question.
First, I will start out with the timer I tried to make that counts down at 5 second intervals from 30 seconds and then goes at 1 second intervals when it reaches 5 seconds.
void StartGame(string &in leverName, int alState)
{
if(alState==1)
{
SetLocalVarInt("i", 0);
AddTimer("Winnings", 30, "Winnings");
if(GetTimerTimeLeft("Winnings") == 30.0f)
{
SetMessage("Messages", "30", 1);
}
if(GetTimerTimeLeft("Winnings") == 25.0f)
{
SetMessage("Messages", "25", 1);
}
if(GetTimerTimeLeft("Winnings") == 20.0f)
{
SetMessage("Messages", "20", 1);
}
if(GetTimerTimeLeft("Winnings") == 15.0f)
{
SetMessage("Messages", "15", 1);
}
if(GetTimerTimeLeft("Winnings") == 10.0f)
{
SetMessage("Messages", "10", 1);
}
if(GetTimerTimeLeft("Winnings") == 5.0f)
{
SetMessage("Messages", "5", 1);
}
if(GetTimerTimeLeft("Winnings") == 4.0f)
{
SetMessage("Messages", "4", 1);
}
if(GetTimerTimeLeft("Winnings") == 3.0f)
{
SetMessage("Messages", "3", 1);
}
if(GetTimerTimeLeft("Winnings") == 2.0f)
{
SetMessage("Messages", "2", 1);
}
if(GetTimerTimeLeft("Winnings") == 1.0f)
{
SetMessage("Messages", "1", 1);
}
if(GetTimerTimeLeft("Winnings") == 0.0f)
{
SetMessage("Messages", "0", 1);
}
}
}
So as you can see when you would pull said lever down it would go to the "StartGame" function, return the "score" or variable "i" back to zero, add a timer to go to the "Winnings" function after 30 seconds, and obviously make the countdown of 30 second for the player to see. When I pull the lever down "30" will pop up as a message but the following messages will not show.
Last question is about when the timer "Winnings" ends and you get you're "prize".
void Winnings(string &in asTimer)
{
for(int i; i == 0; i--)
{
CreateEntityAtArea("money", "coins_large.ent", "money_spawn", false);
AddTimer("", 3, "Winnings");
}
}
So all this script does is it takes the value of "i" and then each time it loops it will subtract one from "i" until reaching zero. Thus, you get you're "prize". I also do realize that I need to point the timer towards a different function and THEN back to the "Winnings" function. And just for a little more info on what i'm try to do. As you will see in the picture below. The lever is to the right of you to actually start the game or the 30 second countdown to try to get as many points as you can. The way it works is that in the model editor I made the plate unbreakable and also have no gravity. Then, I set up three points at the end of the "lane" that when one of the points collide with the plate it adds 1 being if it hit the right or left point and 2 if it hits the center. You're score at the end is represented by bags of 50 thalers. Thus, left and right points equals 50 points and the middle equals a hundred. Thanks in advance for the help!